Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Basic shell script

Status
Not open for further replies.

barryp

Programmer
Jan 30, 2002
48
GB
Please, for a beginner, what is wrong with

echo "Are you sure ?"
read reply
if [ $reply="y" ]
then
echo "you indicated yes"
else
echo "you indicated no"
fi

 
You need spaces on both sides of the equal sign. And you should use something like
Code:
if [ x$reply = xy ]
because just $reply = y will cause errors when $reply is empty. //Daniel
 
Also note that there is a special forum here on Tek-Tips for UNIX scripting. If you have other questions later, you might want to ask them there. //Daniel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top