Using the Return Value
Functions, like programs, succeed or fail. That's what $? is about. (At the shell level, $? tells whether the last command succeeded or failed. Here, as far as the shell is concerned, the function is just like a command.)
This means that if you have a function to check out and build code
This means that if you have a function to check out and build code
You can call it like this:get-N-make() {
svn co $*
(
cd $_
make
)
} &> /dev/null
(Notice that you can redirect the output of a function as part of its definition.
get-N-make -Dyesterday mycode ||
die "something in the checkout or build failed"