problems with shell script
i am somewhat forced to use an environmet i am really not used to. I have a large prepare script that generates a jobscript for our cluster. I stripped out a minimal example that shows what is not working right now.
#! /bin/ksh
EXPDIR="/home/user1/tmp/exp"
EXPNO="${testno}"
if [ ! -d "$EXPDIR" ]; then
/client/bin/mkdir -p "${EXPDIR}"
cd "${EXPDIR}"
fi
jobname="${jobname:-${EXPNO}}"
jobfile="${jobfile:-${EXPDIR}/${jobname}.job}"
cat >"${jobfile}" <<EOF1
#-----------------------------------------------------------------------------
# TEST
#-----------------------------------------------------------------------------
This script should create a file called testno.job
containing
#----------------------------------------------------------开发者_运维知识库-------------------
# TEST
#-----------------------------------------------------------------------------
in the directory /home/user1/tmp/exp
and create the directory if it is not existing. The only problem is that the file is not called testno.job
but .job
. Can you help me out?
Obviously, the jobfile
variable contains .job
rather than testno.job
. I think you need to set testno
because it is used to produce the jobname
variable.
IMHO, you haven't defined the ${testno} variable.
精彩评论