Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does qsub pass command line arguments to my script?

Tags:

qsub

pbs

torque

When I submit a job using

qsub script.sh

is $@ setted to some value inside script.sh? That is, are there any command line arguments passed to script.sh?

like image 391
becko Avatar asked Oct 21 '14 13:10

becko


People also ask

How can you pass command line arguments to a script?

Arguments can be passed to the script when it is executed, by writing them as a space-delimited list following the script file name. Inside the script, the $1 variable references the first argument in the command line, $2 the second argument and so forth.

What is qsub command?

The qsub command is used to submit jobs to the queue. job, as previously mentioned, is a program or task that may be assigned to run on a cluster system. qsub command is itself simple, however, it to actually run your desired program may be a bit tricky. is because qsub, when used as designed, will only run scripts.

How do you pass an argument to a script in Unix?

To invoke a function, simply use the function name as a command. To pass parameters to the function, add space separated arguments like other commands. The passed parameters can be accessed inside the function using the standard positional variables i.e. $0, $1, $2, $3 etc.

How do I pass command line arguments in Ubuntu?

You can pass command-line arguments containing blanks by enclosing them in quotes. For example, try ./simple 'foo bar' baz . Notice that $1 expands to foo bar this time, and not just to foo .


1 Answers

You can pass arguments to the job script using the -F option of qsub:

qsub script.sh -F "args to script" 

or inside script.sh:

#PBS -F arguments

This is documented here.

like image 77
dbeer Avatar answered Oct 05 '22 09:10

dbeer