gmanpert
asked on
Use of colon in this shell script
Hi the following lines appear in a bash shell script. I would like to know what these lines is doing, the colon in particular.
: ${pidfile:=/bin/lcl_script s/httpd2.p id}
pid=$(<$pidfile)
: ${pidfile:=/bin/lcl_script
pid=$(<$pidfile)
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
: ${pidfile:=/bin/lcl_script
pid=$(<$pidfile)
sudo kill -TERM $pid
case $? in
1) echo -n "(not running)";;
0) # wait until the processes are gone (the parent is the last one)
echo -n "(waiting for all children to terminate) "
for ((wait=0; wait<120; wait++)); do
if test -f $pidfile; then # -f test for regular file
usleep 50000
continue
fi
if ! test -f /proc/$pid/exe; then
break
fi
if test "$(readlink /proc/$pid/exe 2>/dev/null)" = $apache_bin; then
usleep 50000
else
break
fi
done
;;
esac