Is there a Windows native port of Bash or Bourne Shell(no cygwin)?

2008-01-27 Thread Chen (陈) Jun (军)
Hi, everyone, I'm new to this list. I'd like to ask is there a Windows native port of Bash or Bourne Shell? By saying "Windows native", I mean that this shell program does not rely on cygwin. More specifically, it has the following characteristics: * The built-in command pwd should return Win

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

capturing sub-expressions?

2008-01-27 Thread Linda Walsh
I was wondering -- in the bash substitute commands ${..%%|##|//} etc, is there a way to "capture" a subexpression, so that I can use the subexpression in the replacement string so I can end up 'only' with the the subexpression? If the full expression was in a shellvar "Options", I thought about u

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

Exit application with two function calls

2008-01-27 Thread abi
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 echo "$input" else