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

Re: Silent shell but not silent script



On Sep 2,  1:09pm, DervishD wrote:
}
}     Sometimes the command I have to run won't exist, so zsh will
} issue that error. How the heck can I make zsh not to spill the error
} message but at the same time let the command to use stderr and
} stdout?

As far as I can tell, it's impossible.

Redirections are done *before* the command execution is attempted,
which is why this ...

}     $ ./command 2> /dev/null

... succeeds in suppressing the error message.  But that also means
that this ...

}     $ { ./command 2>&1 } 2> /dev/null

... does *not* succeed in suppressing the error, it only succeeds in
sending the error to stdout.

}     The only solution I've found so far is to pipe stderr thru a sed
} script and get rid of any shell message

I'd have suggested 'grep -v "^zsh:"', or egrep with a more specific
set of messages to suppress.



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