Bash脚本如果elif elif不工作

所以我正在试图做一个如果其他语句,如果在一个bash脚本。 到目前为止,当我运行这个脚本,我得到了下面的错误信息“./groupJobs.sh:第76行:语法错误附近意外的标记elif' ./groupJobs.sh: line 76: elif [$ jobsize -lt $ 2];然后“”

我已经在网上看了很多例子,看不出我所做的和别人说的有什么不同。

任何帮助,将不胜感激。 (第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 

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 

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 

Bash在if / elif块中需要一个命令(例如echo )。 评论不算。