有什么不对我的UNIX脚本 [英] what is wrong with my unix script
本文介绍了有什么不对我的UNIX脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
#!/bin/bash
while echo -n "Player's name?"
read name
[ $name != 'ZZZ' ]
do
searchresult=$(grep [$name] playername)
if [ $searchresult = 0 ]
then
echo -n "if See target (T/t) or team name (M/m)?"
while [ [ $target!="T" ] || [ $team!="M" ] ]
read team
read target
do
echo "Please enter only T or M."
done
if $target="T"
then
grep [ $name ] targetselected
else
grep [ $name ] teamselected
fi
else
echo 'no such player'
fi
done
echo You are now exited search
运行时错误说
10号线 - 如果[$ SearchResult中= 0];有这么多的争论,
line 10 - if [ $searchresult = 0 ] ; have so many arguments,
是什么意思呢?我该如何解决?
what is that mean? how can i fix it?
推荐答案
引用变量名:
"$searchresult"
此外,有啊有脚本等故障。
Also, youa have other failures in the script.
- 从里grep删除括号,如果你不需要他们
- 重写条件,而
这篇关于有什么不对我的UNIX脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文