$Id: bash.txt 1883 2008-07-20 23:13:32Z mjs $
bash tips/tricks/HOWTOsYou can just do things like:
if cp $1 $2 ; then
echo succeeded
else
echo failed
fi
Alternatively, $? holds the exit status of the most recently executed command.
`command`
or
$(command)
To redirect stdout to /dev/null, and stderr to the tty:
$ tidy index.html 2>/dev/stdout 1>/dev/null
${foo}
or
$foo