开发者

problems with shell script

开发者 https://www.devze.com 2023-03-12 04:26 出处:网络
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 wor

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号