1 |
On Friday 13 October 2006 07:55, Grant wrote: |
2 |
> #!/bin/bash |
3 |
[SNIP] |
4 |
> vobcopy -m || exit |
5 |
> mkisofs -dvd-video -V $TITLE -o $FILENAME $TITLE || exit |
6 |
[SNIP] |
7 |
> |
8 |
> Can you tell me what purpose the "|| exit" portions serve? |
9 |
|
10 |
It's quite common is bash scripts to define a function named die: |
11 |
|
12 |
die() { |
13 |
echo "$@" |
14 |
exit 1 |
15 |
} |
16 |
|
17 |
If you define that at the top of your script you ceplace the above with this: |
18 |
|
19 |
> vobcopy -m || die "vobcopy failed" |
20 |
> mkisofs -dvd-video -V $TITLE -o $FILENAME $TITLE || die "mkisofs failed" |
21 |
|
22 |
I hope you get the point... |
23 |
|
24 |
-- |
25 |
Bo Andresen |