我编写了以下 shell 脚本:
#!/bin/ksh
main()
{
echo 'Checking if process is running...'
if [ [ps -ef|grep "Djava.security.auth.login.config"|grep -v grep|wc -l] != 0 ]; then
echo "startEventProcessorScript is not running"
nohup /apps/fasigw/test/bin/startEventProcessor &
fi
echo '******************************************************************'
echo ' Script started successfully '
echo '******************************************************************'
}
main $*
当我执行上述脚本时,我收到以下错误消息:
Checking if process is running...
main[3]: test: ] missing
wc: illegal option -- ]
usage: wc [-c|-m] [-lw] [name ...]
我无法解决这个问题。startEventProcessor是路径 /apps/fasigw/test/bin 中的脚本。请帮忙