Why am i getting an unexpected operator error in bash string equality test? -


where error on line four?

if [ $bn == readme ]; 

which still if write

if [ $bn == readme ] 

or

if [ "$bn" == "readme" ]; 

context:

for fi in  /etc/uwsgi/apps-available/*           bn=`basename $fi .ini`         if [ $bn == "readme" ]                         echo "~ ***#*** ~"         else                 echo "## shortend convience ##"         fi done 

you can't use == single bracket comparisons ([ ]). use single = instead. must quote variables prevent expansion.

if [ "$bn" = readme ]; 

if use [[ ]], apply , wouldn't need quote first argument:

if [[ $bn == readme ]]; 

Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -