16.05.2015 Views

Working with the Unix OS

Working with the Unix OS

Working with the Unix OS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Unix</strong> Shells<br />

if $append<br />

<strong>the</strong>n<br />

tee -a "$output"<br />

else<br />

cat<br />

fi<br />

done<br />

exit 0 # return a healthy exit status<br />

Built-in Shell Commands<br />

: null command<br />

. execute a program or shell script<br />

'pgm' replace <strong>with</strong> output of pgm command<br />

break exit from for, while, or until loop<br />

cd<br />

change working directory<br />

continue start <strong>with</strong> next iteration of for, while<br />

eval scan and evaluate <strong>the</strong> command line<br />

exec execute a program in place of current process<br />

exit exit from current shell<br />

export place <strong>the</strong> value of a variable in calling environment<br />

newgrp change users group<br />

read read a line from standard input<br />

readonly declare a variable to be readonly<br />

set<br />

Set shell variables (display all variables)<br />

shift promote each command line argument<br />

times display times for current shell and its children<br />

trap trap a signal<br />

umask File creation mask<br />

wait wait for a background process to terminate<br />

echo display arguments<br />

getopts parse arguments to a shell script<br />

hash remember location of command in search path<br />

pwd<br />

print working directory<br />

return exit from a function<br />

test compare arguments<br />

type display how each arg would be interpreted<br />

ulimit limit <strong>the</strong> size of files written by shell<br />

unset remove a variable or function<br />

! Shell Variables<br />

HOME pathname of your home directory<br />

IFS<br />

internal field separator<br />

PATH search path for commands<br />

PS1 prompt string 1<br />

PS2 prompt string 2<br />

MAIL file where system stores your mail<br />

H<strong>OS</strong>T <strong>the</strong> host name of <strong>the</strong> computer<br />

SHELL identifies name of invoked shell<br />

24

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!