$path: 2.5 The Test Command
$path: 2.5 The Test Command
will print on the terminal the file wn in this directory. The command cd with no argument is equivalent to
cd $HOME
This variable is also typically set in the the user's login profile. $PATH A list of directories that contain commands (the search path). Each time a command is executed by the shell a list of directories is searched for an executable file. If $PATH is not set then the current directory, /bin, and /usr/bin are searched by default. Otherwise $PATH consists of directory names separated by :. For example,
PATH=:/usr/fred/bin:/bin:/usr/bin
specifies that the current directory (the null string before the first :), /usr/fred/bin, /bin and /usr/bin are to be searched in that order. In this way individual users can have their own `private' commands that are accessible independently of the current directory. If the command name contains a / then this directory search is not used; a single attempt is made to execute the command. $PS1 The primary shell prompt string, by default, `$ '. $PS2 The shell prompt when further input is needed, by default, `> '. $IFS The set of characters used by blank interpretation (see section 3.4).
returns zero exit status if file exists and non-zero exit status otherwise. In general test evaluates a predicate and returns the result as its exit status. Some of the more frequently used test arguments are given here, see test (1) for a complete specification. test s true if the argument s is not the null string test -f file
true if file exists test -r file true if file is readable test -w file true if file is writable test -d file true if file is a directory
The value tested by the while command is the exit status of the last simple command following while. Each time round the loop command-list1 is executed; if a zero exit status is returned then commandlist2 is executed; otherwise, the loop terminates. For example,
while test $1 do ...