topical media & game development

talk show tell print

basic-shell-09-process-id.sh / sh



  
  echo "The current process ID is $$."
  
  if [ "!" != "" ]
  then
      echo "The ID of the last-run background process is !."
  else
      echo "No background process ID stored in" '!'
  fi
  
  # Now, run something in the background.
  ls > /dev/null &
  if [ "!" != "" ]
  then
      echo "The ID of the last-run background process is !."
  else
      echo "No background process ID stored in" '!'
  fi
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.