parameter expansion into batch?

I have no idea how hard this is, but can there be parameter expansion (or aliases) into the batch file? Currently I have my batch file which I edit for each new project. It’s only a couple of lines

make.contigs(file=PROJECTNAME.file)
[...]
summary.tax(taxonomy=PROJECTNAME.trim.contigs.good.unique.good.filter.precluster.pick.nr_v119.wang.pick.taxonomy, count=PROJECTNAME.trim.contigs.good.unique.good.filter.precluster.denovo.uchime.pick.pick.pick.count_table, list=PROJECTNAME.trim.contigs.good.unique.good.filter.precluster.pick.pick.opti_mcc.list, size=10000, persample=true, label=0.03)

but I’m lazy and would love to set PROJECTNAME= in my qsub/slurm (queue managment) file and use $PROJECTNAME within my batch.

Hey Kendra,

Here’s what I do if there are only a few lines. Make a new bash script file like so…

#!bash
PROJECTNAME=$1

mothur "#make.contigs(file=$PROJECTNAME.file);[...];summary.tax(taxonomy=$PROJECTNAME.trim.contigs.good.unique.good.filter.precluster.pick.nr_v119.wang.pick.taxonomy, count=$PROJECTNAME.trim.contigs.good.unique.good.filter.precluster.denovo.uchime.pick.pick.pick.count_table, list=$PROJECTNAME.trim.contigs.good.unique.good.filter.precluster.pick.pick.opti_mcc.list, size=10000, persample=true, label=0.03)"

You can then run this from the qsub script as:

bash myscript.bash my_project

myscript.bash would be the name of the bash script and my_project becomes the value of PROJECTNAME

ah! thanks. One of these days I need to learn bash fundamentals :oops: