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

Re: Slightly OT: Error-Handling in a Pipeline, preferably non-zsh

On Monday, August 16, 2004, at 03:41 AM, Bart Schaefer wrote:

On Sun, 15 Aug 2004, Aaron Davies wrote:

As a final note, you probably want "$@" in double quotes.

Really? I used it with multi-word commands (like "kill -9") with no problems.

What happens when one of the arguments of the command is a quoted word containing spaces? E.g. supposing your "generalized killall" is named "runcommandonpidof" (since you've never told us what it _is_ called), try

It's called "toall".

  sleep 30 &
  runcommandonpidof sleep print -l "this should be on one line"

(and try it in a non-zsh shell, where word splitting applies; no cheating by letting zsh preserve the quoting for you, you asked for portability).

What is "print"? There doesn't seem to be an executable of that name on my (OS X 10.3) box, and printf doesn't have a "-l" option. I tried something similar with echo, and saw no difference.

toall sleep echo "this is one line"


this is one line 19980

whether or not $@ is in quotes. (I was invoking the script from sh, which I think on this box is actually bash running in sh-mode.)
    __                      __
   /  )                    /  )
  /--/ __. .__  ______    /  / __. , __o  _  _
 /  (_(_/|_/ (_(_) / (_  (__/_(_/|_\/ <__</_/_)_

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