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

According to [EMAIL PROTECTED] on 10/28/2006 9:42 PM:
>     f1="/a/b/a-000"
>     f2="/a/b/c d-000"
>     touch "a-000.ext"
>     touch "c d-000.ext"
> 
>     for file in "$(basename \"$f1\")"*.ext "$(basename \"$f2\")"*.ext
>     do
>       echo "one=$file"
>     done
> 
>     for file in "`basename \"$f1\"`"*.ext "`basename \"$f2\"`"*.ext
>     do
>       echo "two=$file"
>     done
> -----------
> 
> The backticks work perfectly.
> But the $() gets it very wrong and leaves a double-quote in the result.

That's because `` and $() have different syntax, as required by POSIX.
You should just do $(basename "$f1"), rather than $(basename \"$f1\").

- --
Life is short - so eat dessert first!

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

iD8DBQFFRChM84KuGfSFAYARAgo0AKC1UI0OZPXEqpm3sOk255oaSqr5VACggpaY
vyvKHOXSYcNX5BZQFjdXOVI=
=7InC
-----END PGP SIGNATURE-----


_______________________________________________
Bug-bash mailing list
Bug-bash@gnu.org
http://lists.gnu.org/mailman/listinfo/bug-bash

Reply via email to