1 |
--- Bo Ørsted Andresen <bo.andresen@××××.dk> wrote: |
2 |
|
3 |
> It's quite common is bash scripts to define a |
4 |
> function named die: |
5 |
> |
6 |
> die() { |
7 |
> echo "$@" |
8 |
> exit 1 |
9 |
> } |
10 |
|
11 |
Or, with use of a specific return code: |
12 |
die() { |
13 |
RT=$1 |
14 |
shift |
15 |
echo "$@" |
16 |
exit $RT |
17 |
} |
18 |
|
19 |
and call it either with the error code of the previous |
20 |
program: |
21 |
> vobcopy -m || die $? "vobcopy failed" |
22 |
or your own return code |
23 |
> vobcopy -m || die 58 "vobcopy failed" |
24 |
|
25 |
Just a point a detail, if it can be useful... |
26 |
|
27 |
G. Moko |
28 |
|
29 |
|
30 |
__________________________________________________ |
31 |
Do You Yahoo!? |
32 |
Tired of spam? Yahoo! Mail has the best spam protection around |
33 |
http://mail.yahoo.com |
34 |
-- |
35 |
gentoo-user@g.o mailing list |