Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: why does this exit = 1 ?



strange thou, it works for me, tested it in a zsh-function!
I did

try() {
 if [ ! -r ... ]
 then echo no file
 fi
}

and tested with 'try; echo $?'

and file or no file the result was 0
(on zsh or sh;  Sun or LINUX(where sh==bash)

So what does happen really ?

Stucki

On Sun, 5 Apr 1998, Michael Barnes wrote:

> Subject: Re: why does this exit = 1 ?
> Date: Sun, 5 Apr 1998 04:22:20 -0400 (EDT)
> 
> The if statement returns false so the script returns false (1),
> if you want the script to return true just add exit 0 at the end.
...
> On Sun, 5 Apr 1998, Timothy J Luoma wrote:
> > I have this little snippet:
> > ...
> > if [ -r /LocalLibrary/Images/Icons/tempPark.tiff -a ! -r /tmp/.dir.tiff ] then   
> >          ln -s /LocalLibrary/Images/Icons/tempPark.tiff /tmp/.dir.tiff
> > fi
> > 
> > When I run it and there is already a /tmp/.dir.tiff it exits = 1


Christoph von Stuckrad       * *  | talk to  | <stucki@xxxxxxxxxxxxxxxxx> \
Freie Universitaet Berlin    |/_* | nickname | ...!unido!fub!leibniz!stucki|
Fachbereich Mathematik, EDV  |\ * | 'stucki' | Tel:+49 30 838-75459        |
Arnimallee 2-6/14195 Berlin  * *  |  on IRC  | Fax:+49 30 838-75454       /



Messages sorted by: Reverse Date, Date, Thread, Author