Link to home
Start Free TrialLog in
Avatar of gmanpert
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_scripts/httpd2.pid}
pid=$(<$pidfile)
Avatar of gmanpert
gmanpert

ASKER

Actually, here is the whole code snippet.

: ${pidfile:=/bin/lcl_scripts/httpd2.pid}
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

ASKER CERTIFIED SOLUTION
Avatar of PHeadland
PHeadland

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial