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

zargs: unexpected, non-xargs behaviour



Hi,

Consider this script:

# ----------------------------------------------------

   autoload -U zargs

   data=(foo bar)

   echo $data | xargs -n 1 echo XX
   zargs -n 1 -- $data -- =echo XX

# ----------------------------------------------------

I expected these to be equivalent, but here's the output:

   $ zsh < zargs_test.sh
   XX foo                                                                         
   XX bar                                                                         
   zargs: argument list too long                                                  
   zsh: exit 1     zsh < zargs_test.sh

To get zargs to work as intended (separate calls to echo for each
argument), I have use "-n 2".

So, at least for this example, when the documentation says "This function
works like GNU xargs, ...", that doesn't appear to be the case.

Am I missing something?

Steve




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