I need to set-env a variable with contents from a file. In bash I can do this with
export FOO="$(cat /home/username/foofile.dat)"
So far I tried various permutations like
set fp [open "/home/username/foofile.dat"]
set file_data [read $fp]
close $fp
set-env FOO "$file_data"
But I always end up with a “command not found” message from bash trying to evaluate the second line of the file. This shows me that the module load must outputting a string to bash that is only setting the first line of the file to the variable FOO, then the subsequent file lines are getting dropped right to bash to evaluate.
Does anyone have ideas on how I can set a multiline variable from the contents of a file?
(Some keywords for future searchability in the archives: multiline, multi-line, newline)
Byron |