bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: exit from a piped while read does not exit program but function


From: David Dombek
Subject: Re: exit from a piped while read does not exit program but function
Date: Fri, 8 Mar 2002 10:09:39 -0500

Chet:

If I might make a suggestion.  Modify the bash man page to indicate that
exit will not exit all the way out if in a sub-shells.

Thanks

-David


----- Original Message -----
From: "Chet Ramey" <address@hidden>
To: <address@hidden>
Cc: <address@hidden>; <address@hidden>
Sent: Thursday, March 07, 2002 9:04 AM
Subject: Re: exit from a piped while read does not exit program but function


> > Machine Type: i586-pc-linux-gnu
> >
> > Bash Version: 2.05a
> > Patch Level: 0
> > Release Status: release
> >
> > Description:
> > [Detailed description of the problem, suggestion, or complaint.]
> >
> > I have a test program below that reads a file in a function and if an
error occurs it is supposed to
> > exit the program.
> >
> > However, as you can see from this simple program it does not exit.
> >
> > Am I missing the purpose or function of the exit statement?
>
> You are missing the fact that each element of a pipeline is run in a
> subshell.  The `exit' exits the subshell, not the calling program.
>
> --
> ``The lyf so short, the craft so long to lerne.'' - Chaucer
> ( ``Discere est Dolere'' -- chet)
>
> Chet Ramey, CWRU    address@hidden    http://cnswww.cns.cwru.edu/~chet/
>





reply via email to

[Prev in Thread] Current Thread [Next in Thread]