Login shells:
On login (subject to the -noprofile option): if /etc/profile exists, source it.
if ~/.bash_profile exists, source it,
On exit:
Non-login interactive shells:
Non-interactive shells:
|
$$ | The PID of the shell |
$! | The PID of the most recently executed background task |
$? | The staus of the most recently executed foreground task |
$0 | The name of the shell script currently running |
$PWD | The present working dir |
$UID | The user ID of the person running the script |
$EUID | The effective UID of the person running the script |
$RANDOM | A random number |
$SECONDS | The number of seconds since the script started |
$LINENO | The current line number. Useful for errors. |
$IFS | The Internal field seperator. Normally a ' ' |
$PATH | The path to search for commands. Should '.' be in the path? |
$HOME | Your home directory. Changeable!! |
$CDPATH | The path to search when you type 'cd'. |
$PS1 | Your normal prompt |
$PS2 | Your secondary prompt. Nornally used when you have a running quote or a running do ... done loop |
$TMOUT | How long to wait for input before logging someone out. Good for security. |
$noclobber | If this has a value, then you cannot with redirection clobber an existing file. Can be unset with 'unset noclobber' |
let a=3+2/4 | Math!! |
read a b c | Read stdin. The first word is $a, the second is $b, and anything else is $c. |
pushd /tmp | change the cwd to /tmp. Store the pwd in a stack. |
popd | Go back to where the last pushd left from. |
exec /usr/bin/vi | Ends the script. /usr/bin/vi is started, |
shift | $9 becomes $8, $8 becomes $7, $7 becomes $6, etc. |
times | view resource consumption |
-a | report all limits |
-c | Max size of core files. Set to zero to not get core files. |
-d | Processes data segment |
-f | Max size of a file created by shell redirection. |
-m | Max resident set size. |
-s | Max stack size. Stops runaway recursive calls. |
-t | Max CPU time in seconds |
-u | Max number of processes |