vi exit status

Jean-Pierre A. Radley appl at jpr.com
Mon Jun 18 07:00:29 PDT 2007


Bill Campbell propounded (on Sun, Jun 17, 2007 at 04:55:00PM -0700):
| On Sun, Jun 17, 2007, Jean-Pierre A. Radley wrote:
| >John Esak propounded (on Sun, Jun 17, 2007 at 05:57:09PM -0400):
| >| Well, I tried these on FreeBSD and the exit status was 0.  However, wouldn't
| >| you expect it to be thus?
| >| 
| >| Isn't it the exit status of the last command (which I would think is the vi
| >| itself, not commands that worked or didn't work inside vi) the only thing
| >| one can check... and didn't vi succeed?  So, wouldn't you expect it to be 0?
| >
| >Not if it conforms to an older Posix standard, as does the vi binary on
| >SCO or Solaris.
| 
| Are you saying that if anything one does in a vi editing session
| fails, that it should show as an abnormal termination?  If that
| were the case, I doubt that I could ever get out of an editing
| session without an error of some kind.

I asked:

> And so what if I failed several pattern searches while editing
> something?  Why should that affect the exit status at all?

A SCO engineer replied:

> 1. Because that's the way ex/vi "has always worked".
> 2. Because it doesn't matter in practice unless you're
>   running ex/vi as part of a script, and mistyped
>   searches from scripts quite well could be errors.
> 3. Because the POSIX specification for ex/vi includes
>   in the clause 'consequences of errors' "... or
>   when an error is detected that is a consequence of
>   data (not) present in the file, ..." and "ex/vi
>   shall terminate with a nonzero exit status."

-- 
JP
	==> http://www.frappr.com/cusm <==


More information about the Filepro-list mailing list