LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 1440|回复: 1

bad syntax, perhaps a bogus '-' 啥意思?

[复制链接]
发表于 2004-11-6 23:45:06 | 显示全部楼层 |阅读模式
这是从网上找的一个旋转字符的脚本,我试了一下但报错,初学看不很懂这个报错提示。
#!/bin/bash

stardict&
id=$!
char=("-" "/" "|" "\\")

n=0
while ps -ax | grep "^[[:space:]]*$id" >/dev/null
do
  echo -ne "\rWaiting ... ${char[$n]}"
  n=$(((n+1)%4))
  sleep 1
done

echo OK

这是在终端下的输出
$ ./rotate.sh
Warning: bad syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html
Waiting ... -bookname: XDICT汉英辞典 , wordcount 160997
bookname: 牛津现代英汉双解词典 , wordcount 39429
bookname: CEDICT?英?典 , wordcount 25230
bookname: 朗道汉英字典5.0 , wordcount 405719
bookname: 朗道英汉字典5.0 , wordcount 435468
bookname: CDICT5英汉辞典 , wordcount 57510
Audio device open for 44.1Khz, stereo, 16bit failed
Trying 44.1Khz, 8bit stereo.
Audio device open for 44.1Khz, stereo, 8bit failed
Trying 48Khz, 16bit stereo.
Warning: bad syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html
Waiting ... /Warning: bad syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html
Waiting ... |Warning: bad syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html
Waiting ... \Warning: bad syntax, perhaps a bogus '-'? See http://procps.sf.net/faq.html
OK
发表于 2004-11-7 00:04:29 | 显示全部楼层
去掉ps -ax 中的-,改成ps ax 就可以了
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表