number of instance check

view story

http://www.unix.com – Hi, We are getting a curios result in one of AIX script. Its executed using !/bin/ksh . After following line we get result of 3 in in the variable instance_count. instance_count=`ps -ef | grep "script_check_instances.sh" | grep -v "grep" | wc -l` But once we do a "ps -aef | grep script_check_instances.sh" just after instance_count calculation this is what we get 2012-10-13 17:49:59 : the count of instances of the script script_check_instances.sh running in the system is : 3 2012-10-13 17:49:59 : Processes that are running currently using the script (HowTos)