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

[Condor-users] parsing arguments with whitespaces



Hello,

I have a bash script like this one  [1].
It works perfectly from the command line [2].
However, if I submit it with condor-G, with a file like [3], I get this error message [4].

I have tried with double quotes, single qoutes, scaping qoutes, etc. No luck.
Any tip or advice will be more than welcome.

Thank a lot in advance.
Jose


--------------------------------------------------------------------------------------------------------------
[1]
#!/bin/bash

parse_arguments(){

        for WORD in "$@" ; do
            case $WORD in
                --*)  true ;
                    case $WORD in
                        --name=*)
                                                NAME=${WORD/--name=/}
                                                shift ;;
                        --age=*)
                                                AGE=${WORD/--age=/}
                                                shift ;;
                        --address=*)
                                                ADDRESS=${WORD/--address=/}
                                                shift ;;
                        *) echo "Unrecognized argument $WORD"
                            ;;    
                    esac ;;
                    *) echo "Option $WORD not starting with double dash."
                        ;;
            esac
        done
}

parse_arguments "$@"

echo "NAME = "$NAME
echo "AGE = "$AGE
echo "ADDRESS = "$ADDRESS

--------------------------------------------------------------------------------------------------------------
[2]

$ ./person.sh --name=Joe --age=45 --address='Springfield Av'
NAME = Joe
AGE = 45
ADDRESS = Springfied Av

--------------------------------------------------------------------------------------------------------------
[3]

universe  = grid 
globusscheduler = my.grid.site/jobmanager-condor  

executable = person.sh
arguments = "--name=Joe --age=45 --address='Springfield Av'"
transfer_executable = true

transfer_output = true
transfer_error  = true 

output = job.$(Cluster).out
error  = job.$(Cluster).err
log    = job.$(Cluster).log

should_transfer_files = YES
when_to_transfer_output = ON_EXIT

queue

--------------------------------------------------------------------------------------------------------------
[4]

Option Av not starting with double dash.