所以我试图在 bash 脚本中执行 if else if else 语句。截至目前,当我运行此脚本时,我收到以下错误消息“./groupJobs.sh:第 76 行:意外标记附近的语法错误elif'
./groupJobs.sh: line 76:elif [ $jobsize -lt $2 ]; then'”
我在网上查看了多个示例,但看不出我所做的和其他人所说的有什么不同。
任何帮助,将不胜感激。(第 76 行是最后一个 elif 语句)
if [ $filesize -ge $2 ]; then
#goes this way if file is to big to put in a job with anyother files
$filename >> $jobname$jobnumber;
elif [ $jobsize -ge $2 ]; then
#job is done being created
elif [ $jobsize -lt $2 ]; then
#add file to job and move on to next file check
fi
Run Code Online (Sandbox Code Playgroud)
这些elif语句需要一个实际的语句。暂时在这些陈述(或其他任何你想要的)中加入类似echo "job creation done"和echo "add file to job"...
if [ $filesize -ge $2 ]; then
#goes this way if file is to big to put in a job with anyother files
$filename >> $jobname$jobnumber;
elif [ $jobsize -ge $2 ]; then
#job is done being created
echo "whatever you want"
#the above line just has to be some sort of actual statement
elif [ $jobsize -lt $2 ]; then
#add file to job and move on to next file check
echo "whatever you want"
#the above line just has to be some sort of actual statement
fi
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6865 次 |
| 最近记录: |