Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Argument passing in .sh scripts

I have a shell script foo.sh which is a qsub job with content:

    #!/bin/bash -l
    #$ -S /bin/bash
    #$ -N $2
    echo $1

I would like to pass two arguments. If I call qsub foo.sh a b the first argument gets correctly processed and echoed to the command line as 'a'. However, I do not know how to pass an argument in the second case starting with '#$ -N'. In this case $2 does not get evaluated to 'b' but actually '$2' is set. Help would be much appreciated.

like image 459
user1137731 Avatar asked Jan 08 '12 23:01

user1137731


1 Answers

Works fune for me.

I don't know what the -N command means, but

#!/bin/bash -l
#$ -S /bin/bash
#$ -N $2
echo $1
echo $2

when called by sh foo.sh a b promptly echoes

a
b
like image 75
Saptamus Prime Avatar answered Oct 05 '22 13:10

Saptamus Prime