this is my shell script
#!/bin/sh
echo "===="
echo $1
echo "===="
ps -ef | grep -w $1 | grep -v -e "grep"
echo "===="
echo $(ps -ef | grep -w $1 | grep -v -e "grep" | wc -l)
echo "===="
exit 0
then,i execute the shell script at command line.
./test.sh php-fpm
the result is:
====
php-fpm
====
0 986 984 0 4:43PM ?? 0:05.53 php-fpm
70 988 986 0 4:43PM ?? 0:00.00 php-fpm
70 989 986 0 4:43PM ?? 0:00.00 php-fpm
70 990 986 0 4:43PM ?? 0:00.00 php-fpm
0 984 1 0 4:43PM ttys000 0:00.01 sudo php-fpm
501 4098 827 0 10:24AM ttys001 0:00.00 /bin/sh ./test.sh php-fpm
====
7
====
so,my question is:why last output is 7 not 6?
thanks.