-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

According to Herrmann, Justin on 5/6/2008 8:20 AM:
| Description: When I try to pass strings inside double or single quotes
| as command line arguments to my Bash script, leading spaces, trailing
| spaces, and multiple grouped embedded spaces are removed from the
| string.

Of course they are, but that's because the bug is in your script.  You
didn't quote properly.

| #!/bin/bash
| echo $#
| for ((index = 0; index <= $#; index++))
| do
|       echo "$index |$(eval echo \${$index})|"

Based on your command, you really want something like:
~  echo "$index |$(eval echo \"\${$index}\")|"

Or more efficiently:
~  eval 'echo "$index |$'"$index"'|"'

- --
Don't work too hard, make some time for fun as well!

Eric Blake             [EMAIL PROTECTED]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Public key at home.comcast.net/~ericblake/eblake.gpg
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkgg/ncACgkQ84KuGfSFAYBGTQCfRysjoyKq5zmTLnHEf9qizG/R
ZgAAoLFrDQQzr56rZ1DrMBqf8sdsiy0f
=0F/T
-----END PGP SIGNATURE-----


Reply via email to