Re: Exit application with two function calls

2008-01-29 Thread Linda Walsh
Paul Jarc wrote: Linda Walsh <[EMAIL PROTECTED]> wrote: # *1 - using "-e" stops your script immediately on any error Not any error - only those from simple commands. The subtleties are subtle enough that I avoid -e, and use "&&" between all commands instead. paul Yeah...it doesn't catc

Re: Exit application with two function calls

2008-01-28 Thread Linda Walsh
Dang---you're right of course. Didn't test the error case...too used to perl. That's why I drag myself through shell scripts trying to do things I might be tempted to do in perl...*sigh* probably have to resort to a else block, running "Error", then returning the status, i.e.: --- else

Re: Exit application with two function calls

2008-01-28 Thread Andreas Schwab
Linda Walsh <[EMAIL PROTECTED]> writes: > Check_file () > { > if [[ -d "$1" ]]; then echo "$1" # *4 > else return Error "invalid directory: \"$1\""; fi "return" expects a number, not the string "Error" as the first argument and does not take any further argum

Re: Exit application with two function calls

2008-01-27 Thread Paul Jarc
Linda Walsh <[EMAIL PROTECTED]> wrote: > # *1 - using "-e" stops your script immediately on any error Not any error - only those from simple commands. The subtleties are subtle enough that I avoid -e, and use "&&" between all commands instead. paul

Re: Exit application with two function calls

2008-01-27 Thread Linda Walsh
In the spirit of there being more than one solution to every problem, I made the solution "more complicated" :-) in case you wanted to check more error conditions... I included some "Notes" about why I did some things they way I did, since it may not be immediately obvious. Some of them are proba

Re: Exit application with two function calls

2008-01-27 Thread abi
> [EMAIL PROTECTED] schrieb: >> Hi, >> >> I am working on a script and ran into an unusual program. Consider the >> following script which I called how.sh. >> >> = >> >> #!/bin/bash >> >> error () { >> >>echo -e "\n\terror: ${*}\n" >>exit; >> >># kill $$ >> >> } >> >> check_file ()

Re: Exit application with two function calls

2008-01-27 Thread abi
> [EMAIL PROTECTED] writes: > >> = >> >> #!/bin/bash >> >> error () { >> >>echo -e "\n\terror: ${*}\n" >>exit; > > Replace that with "exit 1". You can use any other non-zero exit code. > >># kill $$ >> >> } >> >> check_file () { >> >>input="$*" >> >>if [ -e $input ]; then >

Re: Exit application with two function calls

2008-01-27 Thread Andreas Schwab
[EMAIL PROTECTED] writes: > = > > #!/bin/bash > > error () { > >echo -e "\n\terror: ${*}\n" >exit; Replace that with "exit 1". You can use any other non-zero exit code. ># kill $$ > > } > > check_file () { > >input="$*" > >if [ -e $input ]; then This will fail if the ar

Re: Exit application with two function calls

2008-01-27 Thread Bernd Eggink
[EMAIL PROTECTED] schrieb: Hi, I am working on a script and ran into an unusual program. Consider the following script which I called how.sh. = #!/bin/bash error () { echo -e "\n\terror: ${*}\n" exit; # kill $$ } check_file () { input="$*" if [ -e $input ]; then