Why am i getting an unexpected operator error in bash string equality test? -
this question has answer here:
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
Post a Comment