Solved [Solved] Basic shell script assistance

fred974

Daemon

Reaction score: 37
Messages: 1,584

Hello everyone,

I have been trying to automate a WordPress installation and I seem to have a problem in my last block of code.
Code:
$ ./clitest.sh
Enter the blog name and press [ENTER]:
Fred blog
Enter the the administrator email address and press [ENTER]:
fred@blog.com
Enter the administrator password and press [ENTER]:
mypassword
Blog creation summary

blog_title: Fred blog.
admin email: fred@blog.com.
admin password: mypassword

Continue (y/n)?read: arg count
[: !=: unexpected operator
Could anyone help please?

Here is the source code:
Code:
echo "Enter the blog name and press [ENTER]:"
read blog_title
echo "Enter the the administrator email address and press [ENTER]:"
read admin_email
echo "Enter the administrator password and press [ENTER]:"
read admin_pass

echo "Blog creation summary"

echo "blog_title: $blog_title."
echo "admin email: $admin_email."
echo "admin password: $admin_pass"
# Verify that the information provided is correct
read -p "Continue (y/n)?"
if [ $REPLY != "y" ]; then
        echo "Exiting..."
        exit 1
fi
Thank you.
 

fonz

Son of Beastie

Reaction score: 369
Messages: 2,560

Re: Basic shell script assistance

You probably meant to write
Code:
read -p "Continue (y/n)?" ${REPLY}
 
OP
OP
fred974

fred974

Daemon

Reaction score: 37
Messages: 1,584

Re: Basic shell script assistance

fonz said:
You probably meant to write
Code:
read -p "Continue (y/n)?" ${REPLY}
Thank you.
Code:
read -p "Continue (y/n)?" REPLY
solved it.
 
Top