W
William Park
(crossposted to comp.lang.python, because this may be of interest to
them.)
Python has try-block, within which you can raise exception. Once it's
raised, execution breaks out of the try-block and is caught at the end
of try-block.
Now, Bash has similiar feature. I've added try-block and 'raise'
builtin into Bash-3.0. Typical usage would go something like
try
echo a
raise
echo b
done
or
try
echo a
raise 2
echo b
done in
0) echo okey ;;
1) echo raised 1 ;;
2) echo raised 2 ;;
*) echo really bad ;;
esac
The exception is positive integer and is raised by 'raise' builtin, just
like 'break' for the for/while/until loops. And, it can be caught by
using optional case-like statement.
Ref:
http://freshmeat.net/projects/bashdiff/
help try
help raise
them.)
Python has try-block, within which you can raise exception. Once it's
raised, execution breaks out of the try-block and is caught at the end
of try-block.
Now, Bash has similiar feature. I've added try-block and 'raise'
builtin into Bash-3.0. Typical usage would go something like
try
echo a
raise
echo b
done
or
try
echo a
raise 2
echo b
done in
0) echo okey ;;
1) echo raised 1 ;;
2) echo raised 2 ;;
*) echo really bad ;;
esac
The exception is positive integer and is raised by 'raise' builtin, just
like 'break' for the for/while/until loops. And, it can be caught by
using optional case-like statement.
Ref:
http://freshmeat.net/projects/bashdiff/
help try
help raise