make file script not working


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting make file script not working
# 1  
Old 05-09-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:
Mod Comment code tags for code, please.
# 2  
Old 05-09-2012
Bumping up posts or double posting is not permitted in these forums.

Please read the rules, which you agreed to when you registered, if you have not already done so.

You may receive an infraction for this. If so, don't worry, just try to follow the rules more carefully. The infraction will expire in the near future

Thank You.

The UNIX and Linux Forums.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script to scan the disks and make file system

Hi What I'm trying to do(manually) is logging into the server and running the below mentioned commands ls /sys/class/scsi_device/ | while read i; do echo "- - -" > /sys/class/scsi_device/$i/device/rescan;done lsblk echo -e "o\nn\np\n1\n\n\nw" | fdisk /dev/sdd partx -a /dev/sdd1... (7 Replies)
Discussion started by: James0806
7 Replies

2. Shell Programming and Scripting

How to make script for file transfer?

Hi All, Please suggest me how to make script for file transfer from server X to another server Y. I have some directory path in server X as below: /home/directory_1/ . . /home/directory_n/ where some text files are available in each directory where some files records zero and some files... (6 Replies)
Discussion started by: aaditya321
6 Replies

3. Shell Programming and Scripting

How to make working this regex in perl?

Hello to all, The Regex below is supposed to match all strings except RR45. I've tested in regex101.com and it works, butwhen I try to use it with the perl command below I get the error shown. Regex=(?<=^|RR45)(?!RR45).+?(?=RR45|$) How to fix this? I'm using Cygwin. $ echo... (9 Replies)
Discussion started by: Ophiuchus
9 Replies

4. Shell Programming and Scripting

How to make this code working?

Hi Gurus, I wrote a simple code, but it doesn't work, can body help me to fix the issue. awk -F',' 'BEGIN{n=0}{ NR == FNR {fname;next} { if ($3==fname) n=1 } END{if n==0} }' tmpsrc srcfile.txt Thanks in advance (4 Replies)
Discussion started by: ken6503
4 Replies

5. Shell Programming and Scripting

Read Parameters from one file and make a script

Hi Friends, I have the following input parameters file name input err1 out1 1 40G DET sylamer dir1 dir2 123456 I want to make the following script #!/bin/bash # (5 Replies)
Discussion started by: jacobs.smith
5 Replies

6. Shell Programming and Scripting

Not able to make the file size 0 with the mentioned script

#!/bin/sh ########################################################################################################## #This script is being used for AOK application for cleaning up the .out files and zip it under logs directory. # IBM # Created #For pdocap201/pdoca202 .out files for AOK #1.... (3 Replies)
Discussion started by: mridul10_crj
3 Replies

7. Shell Programming and Scripting

How to make a script to run everytime a new file is copied into a directory??

Hi folks I have a unix script script1 in a directory folder1 and also I have few input log files in this directory. My input log files will be copied into this directory folder1 from the portable thumb drive. Now what I want is I need to run this script1 whenever any new file is copied... (2 Replies)
Discussion started by: ks_reddy
2 Replies

8. AIX

Can I make application for AIX while working on Linux Box

Hi all, I had a large application created using Visual C++. I ported that application using WINE to the Linux platform (ofcourse x86). Now I have to port the same application to AIX which runs over IBM mainframe. I dont have mainframe available but it is required for me to port my application to... (1 Reply)
Discussion started by: noble_curious
1 Replies

9. UNIX for Dummies Questions & Answers

What can make Cronjobs stop working??

Up until two days ago they were working junt fine, then stoped working with out me doing anything. Yesterday they started working again...and then stoped working, at about the same time of day that they stoped working the day before. service crond restart did nothing. All SSH signs point to... (0 Replies)
Discussion started by: Nintendo
0 Replies

10. HP-UX

make -version is not working in HP-UX

hello everyone, I had a HP-UX, i am trying to find the make version ,but it is displaying the error i.e make -v Make: Unknown flag argument v. Stop. make -version Make: Unknown flag argument v. Stop. make --version Make: Unknown flag argument -. Stop. make -V Make: Unknown flag... (2 Replies)
Discussion started by: mannam srinivas
2 Replies
Login or Register to Ask a Question