This repository was archived by the owner on Oct 10, 2019. It is now read-only.
File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -201,19 +201,18 @@ submit_file_environment="#"
201201
202202if [ " x$environment " != " x" ] ; then
203203# Input format is suitable for bourne shell style assignment. Convert to
204- # old condor format (no double quotes in submit file).
205- # FIXME: probably it's better to convert everything into the 'new' Condor
206- # environment format.
204+ # new condor format to avoid errors when things like LS_COLORS (which
205+ # has semicolons in it) get captured
207206 eval " env_array=($environment )"
208- submit_file_environment= " "
209- for env_var in " ${env_array[@]} " ; do
210- if [ " x $submit_file_environment " == " x " ] ; then
211- submit_file_environment= " environment = "
212- else
213- submit_file_environment= " $submit_file_environment ; "
214- fi
215- submit_file_environment= " ${submit_file_environment}${env_var} "
216- done
207+ dq= ' " '
208+ sq= " ' "
209+ # map key=val -> key='val'
210+ env_array=( " ${env_array[@] / = / = $sq } " )
211+ 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 } " )
215+ submit_file_environment= " environment = \" ${env_array[*]} \" "
217216else
218217 if [ " x$envir " != " x" ] ; then
219218# Old Condor format (no double quotes in submit file)
You can’t perform that action at this time.
0 commit comments