#!/bin/sh
read a
if ["$a" = apple] ; then
echo "ur good";
else
echo "ur bad"
exit
fi
I am getting the following error!
/home/xyz/scripts >help.sh
apple
help.sh[3]: [apple: not found.
ur bad
can i know what would be the wrong in my script
#!/bin/sh
read a
if ["$a" = apple] ; then
echo "ur good";
else
echo "ur bad"
exit
fi
I am getting the following error!
/home/xyz/scripts >help.sh
apple
help.sh[3]: [apple: not found.
ur bad
can i know what would be the wrong in my script
Put space between [ and "$a" it should be like this:
if [ "$a" = apple ] ; then
That works..
Try this
read a
if [ $a = apple ]
then
echo "ur good"
else
echo "ur bad"
fi