Is it possible to expand variables in comments inside a bash script?
I want to write a script to feed into SGE. The qsub syntax allows me to pass additional parameters to the grid engine using lines inside the bash script which begin with #$. For example,
#$ -q all.q
#$ -S /bin/bash
#$ -V
#$ -m beas
#$ -o run_20120103.out
What I want is that the -o parameter is dynamically set to a variable, say $1. So I would naively write
#$ -o run_${1}.out
However, since the line starts with a #, bash ignores it and the variable $1 is not expanded.
Any ideas? Some bash preprocessor? Some other way?
EDIT I just chose $1 as an example. It could just as well be $FOO or $BAR.