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

converting parameter to words



-----BEGIN PGP SIGNED MESSAGE-----

    I have a script that I want to pass multiple arguments to.  These
arguments, however, need to appear with a '-r' in front of them in the
command executed inside the script. For example, if I do this:

$ example this that other

    The script will need to execute

command -r this -r that -r other

    One thought on this was:

#!/bin/zsh

for i
do
  temp="$temp -r $i"
done

command $temp

     Of course, this doesn't work because zsh passing the string inside
$temp as a single argument to the program, instead of parsing it for
words.  From the man page, it sounds like ${^temp} or ${=temp} should
work, but neither does.

- --
"Restore your inalienable human rights.             Jack McKinney
 Vote Libertarian.  http://www.lp.org               http://www.lorentz.com
 http://www.harrybrowne2000.org
F4 A0 65 67 58 77 AF 9B  FC B3 C5 6B 55 36 94 A6    jackmc@xxxxxxxxxxx

-----BEGIN PGP SIGNATURE-----
Version: 2.6.2

iQCVAwUBOecuukZx0BGJTwrZAQH/6AP/bVpZf0bL4rivlVLVAaSeI+DHbq4z5860
qx6RxhNJWOZSfmlv00F+XrVG6iOogr8tQ9V74QkIY6MssA7QVmpOcFCYYIdyfu9V
RFftK1PgvcUzwAO+qUmzpWySjxMWAuYY5Wr5UYJQjg/mmpwVDZ/fWY9DW4Wnrshn
pwrS9eRgUEE=
=u3lq
-----END PGP SIGNATURE-----



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