can someone please tell me what is wrong with the below. i'm trying to get a script to run if the content of a variable is either small letter y or capital letter Y.
if [ "$adfdf" = "y" || "$adfdf" = "Y" ]
then
whatever
fi
can someone please tell me what is wrong with the below. i'm trying to get a script to run if the content of a variable is either small letter y or capital letter Y.
if [ "$adfdf" = "y" || "$adfdf" = "Y" ]
then
whatever
fi
Which shell? For ksh, try:
if [[ "$adfdf" = "y" || "$adfdf" = "Y" ]]
or even simpler:
if [[ "$adfdf" = [Yy] ]]
or u could use
if [ "$adfdf" == "y" -o "$adfdf" == "Y" ]; then
echo good
fi
thanks a BIZILLION. guys.
The equality test operator is = not ==, however some unix flavour supports it
if [ "$adfdf" = "y" -o "$adfdf" = "Y" ]; then
echo good
fi
Jean-Pierre.