Shell script question -- urgent
Posted on 2003-11-24
I am facing a problem here with shell script.
I am trying to write a very simple script that reads a value from a user and if choice is 1 (for example) we copy file A from one location to another.
If the user choice is 2, we copy file B from another location.
To begin I tried to write a simple if statement but it didn't work.. here is what I did:
echo "Please enter your choice: "
if [ $response=1 ]; then
echo "You chose 1"
elif [ response=2 ]
echo "You chose 2"
echo "Wrong choice"
I get the error unexpected fi and sometimes unmatched if.
Anybody has a solution??
Another issue: When I try to run the shell script file using
I get the message file was is not found ( I am sure it is there )
However, if I go to /bin and do:
$ bash file_path
it works but gives the above error.
Any suggestions for this too?