[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [HTCondor-users] condor_submit with -append arguments



Hi Adriana -

* On 20 Nov 2014, Adriana Bungau wrote: 
> Second file I want to execute using some input parameters:
> 
> $ cat > submit_job.sh
> if [ $# -lt 1 ]
>     then
>     echo "Usage: ./submit_job.sh <radius> <length>"
>     echo "E.g, ./submit_job.sh 60 80"
>     exit
> fi
> radius=$1
> length=$2
> condor_submit -append 'args = $(radius) $(length)'  an.job

Your arguments are getting into the script OK, but they're not being
delivered to condor_submit.  There are two reasons for that:

* You need {curly braces}, not (parentheses), for variable expansions.
$(x) substitutes the output from the command "x" instead.

* You need "double quotes", not 'single quotes', to permit variable
expansion. Single quotes will copy the quoted material literally,
without allowing variables to expand.  (Sometimes that's what you want.)

I would also advise always beginning a shell script with #!/bin/sh or
#!/bin/bash.  This is not always necessary, but it is always safe and
it protects you from some strange edge cases.

So a modified script might be:

$ cat > submit_job.sh
#!/bin/sh
if [ $# -lt 1 ]
    then
    echo "Usage: ./submit_job.sh <radius> <length>"
    echo "E.g, ./submit_job.sh 60 80"
    exit
fi
radius=$1
length=$2
condor_submit -append "args = ${radius} ${length}"  an.job

-- 
       David Champion â dgc@xxxxxxxxxxxx â University of Chicago
Enrico Fermi Institute â Computation Institute â USATLAS Midwest Tier 2
                      OSG Connect â CI Connect