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

Re: trying to create a "|| failed" function



On 15/03/2013, at 12:39 , TJ Luoma <luomat@xxxxxxxxx> wrote:

> foo || failed
> 
> bar || failed

You could pass a parameter into failed:

  foo || failed 'foo'

  bar || failed 'bar'

Or go even further and have "failed" run the command:

  notify_if_failed foo with parameters

Then notify_if_filed would contain run $@, evaluate the result and return the appropriate exit code, performing any required logging along the way.



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