Skip to content
This repository was archived by the owner on Oct 10, 2019. It is now read-only.

Commit d42bd80

Browse files
committed
escape single-quote and double-quote characters in environment
1 parent 6294ef0 commit d42bd80

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/scripts/condor_submit.sh

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,14 @@ if [ "x$environment" != "x" ] ; then
204204
# new condor format to avoid errors when things like LS_COLORS (which
205205
# has semicolons in it) get captured
206206
eval "env_array=($environment)"
207-
sq="'" # map key=val -> key='val'
207+
dq='"'
208+
sq="'"
209+
# map key=val -> key='val'
208210
env_array=("${env_array[@]/=/=$sq}")
209211
env_array=("${env_array[@]/%/$sq}")
212+
# escape single-quote and double-quote characters (by doubling them)
213+
env_array=("${env_array[@]//$sq/$sq$sq}")
214+
env_array=("${env_array[@]//$dq/$dq$dq}")
210215
submit_file_environment="environment = \"${env_array[*]}\""
211216
else
212217
if [ "x$envir" != "x" ] ; then

0 commit comments

Comments
 (0)