Cshell 脚本中,while: Expression Syntax.

qq_18751439 2016-10-10 09:05:27
求助 为什么代码总是出现这个语法错误

#-------------------------------------------------------------------------------------------------

while [ $id -le $ens_size ]
do

if [ $id -lt $n1 ]
then
string1=$name1$s2$id
string2=$name2$s2$id
fi

if [ $id -ge $n1 ] ; then
string1=$name1$id$name3
string2=$name2$id$name3
fi

echo $id $ens_size $string
echo $string1
echo $string2

#----------------------------------------------------------

rpath1=$home/$string1
rpath2=$home/$string2

cd $home

rm -r $rpath1
rm -r $rpath2

mkdir $rpath1
mkdir $rpath2

id=`echo "$id + 1" | bc`

done
...全文
2442 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
nswcfd 2016-10-28
  • 打赏
  • 举报
回复
http://www.tcsh.org/tcsh.html/Builtin_commands.html#while while (expr) ... end Executes the commands between the while and the matching end while expr (an expression, as described under Expressions) evaluates non-zero. while and end must appear alone on their input lines. break and continue may be used to terminate or continue the loop prematurely. If the input is a terminal, the user is prompted the first time through the loop as with foreach.
nswcfd 2016-10-28
  • 打赏
  • 举报
回复
csh的语法和bash不一样。 这个看起来像bash的语法。
dingybin 2016-10-28
  • 打赏
  • 举报
回复
是否哪个语法字段有格式的问题
dingybin 2016-10-28
  • 打赏
  • 举报
回复
报错是什么呢?

742

社区成员

发帖
与我相关
我的任务
社区描述
该论坛主要探讨Linux系统在IBM Power平台的安装、部署、应用开发等话题,并为网友们提供自由交流的平台。
社区管理员
  • Power Linux社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧