Am Freitag 09 Februar 2007 schrieb Hugh Sasse:
> On Fri, 9 Feb 2007, Martin Krischik wrote:
> > Am Freitag 09 Februar 2007 schrieb Charles E Campbell Jr:
> > > :q  :wq  :q!   -- these are normal quits (:wq also writes)
> > > :
> > > :cq  -- quits, but Vim will return an error code
> >
> > Thats exactly as far as I came without help. Now, what I was looking for
> > was "quit without error code" - or better, since there is allways an
> > error code, "quit with error code 'success'".
>
> I don't know the answer to that, but...



> > Currently Vim is seems to me that randomly chooses an error code to
> > return - which is not good for bash scripts running in "set -o errexit"
> > mode.
>
> ... would something like
>     ( $(vim -E ...) || true )
> solve this?  

Interesting, I have not considere the "||" operator as workaround - currently 
I use:

if vim -E ... ;then true ; fi

or:

set +o errexit
vim -E ...
set -o errexit

> > BTW: Any bash script author should at least consider to use "set -o
> > errexit" it is a really usefull debugging tool.
>
> Well, you don't seem to get much in thw way of diagnostics from it, but
> thank you for mentioning it.

For diagnostic use:

set -o xtrace

The important part of errexit is that the script stops when there was an 
error.  And this is why script authors should consider errexit, as in asking 
oneself the question: "Is the script I currently create save to continue 
after an error condition?" - And quite often the answer is: No!

Martin
-- 
Martin Krischik
mailto://[EMAIL PROTECTED]

Attachment: pgpg6KwlLVoii.pgp
Description: PGP signature

Reply via email to