Thursday, November 22, 2007

What differes in Bourne -Korn and CShell ???

shkshcshMeaning/Action
$$%Prompt.


>!Force redirection.


>>!Force append.
> file 2>&1> file 2>&1>& fileCombine stdout and stderr.


{ }Expand elements in list.
` `$( )` `Substitute output of enclosed command.
$HOME$HOME $home Home directory.

~~Home directory symbol.
var=valuevar=valueset var=valueVariable assignment.
export varexport var=valsetenv var valSet environment variable.

${nn}
More than 9 args can be referenced.
"$@""$@"
All args as separate words.
$#$#$#argvNumber of arguments.
$?$?$statusExit status.
$!$!
Background exit status.
$-$-
Current options.
. file. filesource fileRead commands in file.

alias x=yalias x yName x stands for y.
casecaseswitch/caseChoose alternatives.

cd ~-popd/pushdSwitch directories.
donedoneendEnd a loop statement.
esacesacendswEnd case or switch.
exit [n]exit [n]exit [(expr)]Exit with a status.
for/dofor/doforeachLoop through variables.

print -rglobIgnore echo escapes.
hashalias -thashstatDisplay hashed commands (tracked aliases).
hash cmdsalias -t cmdsrehashRemember command locations.
hash -r
unhashForget command locations.

historyhistoryList previous commands.

r!!Redo previous command.

r str!strRedo command that starts with str.

r x=y cmd !cmd:s/x/y/Edit command, then execute.
if [ $i -eq 5 ]if ((i==5))if ($i==5)Sample if statement.
fifiendifEnd if statement.
ulimitulimitlimitSet resource limits.
pwdpwddirsPrint working directory.
readread$<Read from terminal.
trap 2trap 2onintrIgnore interrupts.

unaliasunaliasRemove aliases.
untiluntil
Begin until loop.
while/dowhile/dowhileBegin while loop.