1
1
Runnning the command gives
wget_exam -h
Usage: wget_exam2 <fileType> <source>
exit // then immediately Terminal shut dows
The code
# example wget_exam2 java http://www.example.com/ex_1
function wget_exam2 {
while [[ $1 == -* ]]; do
case "$1" in
-h|--help|-\? ) echo "Usage: wget_exam2 <fileType> <source>"; exit;;
--) shift; break;;
-*) echo "invalid option: $1"; echo "Usage: wget_exam2 <fileType> <source>"; exit;;
esac
done
wget --random-wait -nd -r -p -A "$1" -e robots=off -U mozilla "$2"
}
Questioner is expecting invocations of the function not to result in exits from their shell. Dennis' answer below explains why it does, and how to fix it. – dubiousjim – 2010-02-21T11:47:55.127
Are you joking? You get the desired output from the -h switch... – Bobby – 2010-01-20T12:59:38.590
do we have a
[smells-like-homework]
tag yet? – quack quixote – 2010-01-20T13:41:53.0471Simple question: what is actually wrong? What do you expect? – Gnoupi – 2010-01-20T17:01:03.167