Core iTOps Tube

Wednesday, 9 May 2012

make file script not working

Hi All,



I have one requirement in my automation .



I need to pass values like 1 , 2 , 3 to MY_IMAGE in command line in linux .



I had defines activities for all these inputs in other make file.



The code similar to below i wrote for my requirement. Issue was whenever i passes values like MY_IMAGE=1 , MY_IMAGE=2 ,MY_IMAGE=3 it's printing only echo ACT_DO=XYZ;



It's not displaying the other info whenever i selected 2 or 3 .can any one check and correct my code .thanks in advance.






Code:


export MY_IMAGE

 MY_IMAGE=$img_value;

  if [ $img_value :="1" ]

 then

    echo ACT_DO=XYZ;

 else

  if [ $img_value :="2 ]

    then

    echo ACT_DO=ABC;

 else

  if [ $img_value :=3 ]

    then

    echo ACT_DO=ETC;

 else

    echo ""$img_value" is unsupported";

    exit 1;

    fi

 fi

fi


---------- Post updated 05-09-12 at 12:08 AM ---------- Previous update was 05-08-12 at 10:53 PM ----------



can any one pls help in shell syntax if possible for the above mentioned requirement











Moderator's Comments:









code tags for code, please.





No comments:

Post a Comment