I'm trying to write a shell script that creates a run script for running an executable. The issue is i'm using variables to assign the job name and number of processors etc contained in the run script, but then within the run script itself it has path name variables which when i run the script get removed since they're not defined higher up.
The issue being everything in the cat like path name variables disappear when i run the script. I'm not even sure if using cat is the right way to be going though anyway so any help would be good
Code:
###########
#!/bin/bash
read -p "How many processors? : " PROCNUM
echo ""
read -p "What's the jobname? : " NAME
echo ""
read -p "What's the walltime? : " WALLTIME
echo ""
cat <<EOF >run.computer
#!/bin/bash --login
#BSUB -n $PROCNUM
#BSUB -J $NAME
#BSUB -W $WALLTIME
MYPATH=/home/work/$LSB_JOBNAME
executable=$MYPATH/executable
WDPATH=/server/$USER/$LSB_JOBNAME
mkdir -p $WDPATH
cp $MYPATH/data $WDPATH/
cd $WDPATH
# $LSB_DJOB_NUMPROC is supplied by LSF and is number of processes
mpirun -np $LSB_DJOB_NUMPROC $executable
EOF
##########
The issue being everything in the cat like path name variables disappear when i run the script. I'm not even sure if using cat is the right way to be going though anyway so any help would be good
Last edited by a moderator: