bash - Variable expansion in comments -
is possible expand variables in comments within bash script?
i want write script feed sge. qsub
syntax allows me pass additional parameters grid engine using lines within bash script begin #$
. example,
#$ -q all.q #$ -s /bin/bash #$ -v #$ -m beas #$ -o run_20120103.out
what want -o
parameter dynamically set variable, $1
. naively write
#$ -o run_${1}.out
however, since line starts #
, bash ignores , variable $1
not expanded.
any ideas? bash preprocessor? other way?
edit chose $1
example. $foo
or $bar
.
variable expansion happens in shell memory, doesn't impact file. therefore, doesn't matter bash expands.
instead, can generate script run on fly, expanded in place:
cat << eof | qsub [options] - #$ -o run_$1.out cmds eof
bash preprocessor sungridengine
No comments:
Post a Comment