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

Re: [HTCondor-users] String composite argument



Hello Michele,

Thanks for the example submit file and scripts. After messing around with those I did get the bash argument to be a full line and not just the first word. First, the arguments line must be contained in double quotes to allow whitespaces:

arguments = "first_argument $(TEST_ARG)"

Then you should be able to make TEST_ARG work with or without quotations:
        Without quotations
                TEST_ARG = 'second argument'       -> argument 2 = second argument
        With Single quotes
                 TEST_ARG = '''second argument'''   -> argument 2 = 'second argument'
        With Double quotes
                  TEST_ARG = '""second argument""'  -> argument 2 = "second argument"

I hope this helps you.
Cheers,
Cole Bollig


From: HTCondor-users <htcondor-users-bounces@xxxxxxxxxxx> on behalf of Michele Peresano <michele.peresano@xxxxxxxxxx>
Sent: Tuesday, December 6, 2022 7:30 AM
To: HTCondor-Users Mail List <htcondor-users@xxxxxxxxxxx>
Subject: Re: [HTCondor-users] String composite argument
 
Dear Cole,

I tried making a specific test and it didn’t work:

my test.sub

TEST_ARG = ''second argument''

executable = test.sh
arguments = first_argument $(TEST_ARG)
log                     = test.log
output                  = test.out
error                   = test.err
should_transfer_files   = Yes
when_to_transfer_output = ON_EXIT
queue

my executable test.sh

#!/usr/bin/env bash
echo "argument 1 = $1"
echo "argument 2 = $2”

Arguments from Dry run

Args="first_argument ''second argument''"

The resulting test.out,

argument 1 = first_argument
argument 2 = ''second