Shell Variables

This page describes environment variables with special meaning defined by the shell.

Search Path

So that a user does not always need to remember the exact location of an executable to invoke a command, a search path variable is used to define which locations and in what order to look for them:

  • $PATH - search path, currently defined in /etc/environment

Note that, due to the common presence of ':' in URIs, paths are separated by ',' instead of ':' as in BASH. This is subject to change.


Information about arguments passed to a script, servlet, or other local executable are made available to the called process in a handful of variables:

  • $# - argument count; e.g. echo hello world would have $#==2, while echo "hello world" would have $#==1
  • $@ - all passed in arguments
  • $0 - the full path to the called executable; use basename $0 for a friendlier name
  • $1, $2, etc. - argument in first position, second position, etc.

Return Status

Every process returns a status code. With HTTP this will generally be one of the predefined HTTP status codes, e.g. 200 (ok), 404 (not found), etc.

  • $? - last process return code
Last modified 20 months ago Last modified on 09/23/15 10:15:53