I have a script like this that I run in terminal:
for iter in 1
do
echo FullFilePath.sh $iter | qsub -V -e ~/pbs/ -o ~/pbs/
done
In the shell file, it looks like this:
matlab -nosplash -singleCompThread -nojvm -r "a=${iter}"
It runs fine until it errors executing the matlab code above, with the error that I had an incorrect use of '=' operator: "a=". Basically $iter was undefined when the matlab script ran. I've tried so many versions and small edits to the above lines of code and it always errors... would appreciate any help.
You need to export
your iter
variable before executing your script.
export iter
So your script might look like:
for iter in {1..5}
do
export iter
sh FullFilePath.sh $iter | qsub -V -e ~/pbs/ -o ~/pbs/
done
Or you could add a line into your FullFilePath.sh
to set the variable to your argument ($1
):
iter=$1