我有以下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