Re: OT: sed + exit status
Hi, Am Samstag, 14. Feb 2009, 08:53:42 -0500 schrieb Robert Huff: > According to the man page: > > EXIT STATUS > The sed utility exits 0 on success, and >0 if an error occurs. > > > However, what constitutes "success" is undefined. A short peek at the source code reveals: An exit code of 1 will be returned when (1) the -? option or an unknown one requested a usage message and (2) the input file cannot be opened. Bertram -- Bertram Scharpf Stuttgart, Deutschland/Germany http://www.bertram-scharpf.de ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: OT: sed + exit status
On February 15, 2009 01:26:27 am Dimitar Vasilev wrote: > >. Is sed "successful" is there are no instances of FOO? Or > > only if there is at least one instance of FOO and it is successfully > > replaced by bar? > > > >Respectfully, > > > > > >Robert Huff > > > > ___ > > freebsd-questions@freebsd.org mailing list > > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > > To unsubscribe, send any mail to " > > freebsd-questions-unsubscr...@freebsd.org" > > Hi Robert, > try to use truss or strace to see the exit codes in both cases. > ___ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to > "freebsd-questions-unsubscr...@freebsd.org" Both cases return an exit code of '0'. You can check more easily by putting the command 'echo $?' directly after the sed command. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
Re: OT: sed + exit status
> > >. Is sed "successful" is there are no instances of FOO? Or > only if there is at least one instance of FOO and it is successfully > replaced by bar? > >Respectfully, > > >Robert Huff > > ___ > freebsd-questions@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-questions > To unsubscribe, send any mail to " > freebsd-questions-unsubscr...@freebsd.org" > Hi Robert, try to use truss or strace to see the exit codes in both cases. ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"
OT: sed + exit status
According to the man page: EXIT STATUS The sed utility exits 0 on success, and >0 if an error occurs. However, what constitutes "success" is undefined. Consider the sed command s/FOO/bar/ . Is sed "successful" is there are no instances of FOO? Or only if there is at least one instance of FOO and it is successfully replaced by bar? Respectfully, Robert Huff ___ freebsd-questions@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-questions To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"