#!/usr/bin/expect下不能用for循环

sh/bash/dash/ksh/zsh等Shell脚本
回复
巴洛特神
帖子: 9
注册时间: 2013-02-07 11:08
系统: win7

#!/usr/bin/expect下不能用for循环

#1

帖子 巴洛特神 » 2013-02-19 15:29

#! /usr/bin/expect

for (( i=3; i>0; i-- )) do
echo "Line $i"
done
~


提示:
wrong # args: should be "for start test next command"
while executing
"for (( i=3"
(file "./Loop-One" line 3)

在#!/bin/bash下就行,是不是,在第一个shell下就不能用for了。。
头像
枫叶饭团
帖子: 14683
注册时间: 2010-06-16 1:05
系统: Mac OS X
来自: Tencent
联系:

Re: #!/usr/bin/expect下不能用for循环

#2

帖子 枫叶饭团 » 2013-02-19 15:33

expect的for不是这么用的吧。。。怎么用的我也不知道,不用这个
巴洛特神
帖子: 9
注册时间: 2013-02-07 11:08
系统: win7

Re: #!/usr/bin/expect下不能用for循环

#3

帖子 巴洛特神 » 2013-02-19 16:17

枫叶饭团 写了:expect的for不是这么用的吧。。。怎么用的我也不知道,不用这个
我在bash下写了个for,for里面调用expect下的script,虽然会耽误时间,但晚上12个小时呢,肯定跑完了。
头像
cjxgm
帖子: 1952
注册时间: 2010-04-23 20:40
系统: Arch Linux
来自: 浙江·杭州
联系:

Re: #!/usr/bin/expect下不能用for循环

#4

帖子 cjxgm » 2013-02-19 17:29

这不是 bash 脚本么?bash 脚本开头怎么能用“#! /usr/bin/expect”?
expect 什么时候是这么用的了?
又不是所有语言都用同一种语法的
wrong # args: should be "for start test next command"
expect 里 for 如粗体所示使用
Clanjor Prods. | Develop for Developers. (C++, Lua) | 作曲编曲 | 实时渲染引擎
头像
zhw2101024
帖子: 1849
注册时间: 2009-03-28 16:10
系统: Arch debian win7
联系:

Re: #!/usr/bin/expect下不能用for循环

#5

帖子 zhw2101024 » 2013-03-08 14:42

expect用的是tcl语法,看看这个http://hi.baidu.com/leejun_2005/item/3b ... 81ae48f57e
回复