我有以下shell脚本:条件shell脚本
#!/bin/sh
output=`./process_test.sh status_pid | grep "NOT STARTED: process_1" --line-buffered`
if[[ -z ${output} ]]
then
echo "process is not running"
else
echo "process is running"
fi
其中./process_test.sh status_pid
是我查找进程是否正在运行或不.e.g效用。如果process_1
未运行,则将显示:NOT STARTED: process_1
。进一步 这个工具是完美的,没有任何问题。我怀疑问题是与if
语法
上运行该脚本,我得到以下的输出:
./test.sh: line 18: if[[ -z NOT: command not found
./test.sh: line 19: syntax error near unexpected token `then'
./test.sh: line 19: `then'
你能帮助解决这个问题?
你用问题和答案的编辑来击败我。 :)速度+1 ... – 2012-01-04 08:08:19