On 2012-02-26 09:20, Adam D. Barratt wrote: | On Sun, 2012-02-26 at 03:30 +0100, Jakub Wilk wrote: | > * Jari Aalto <jari.aa...@cante.net>, 2012-02-08, 02:58: | > >- [ "`head -n 1 \"$1\"`" = "-----BEGIN PGP SIGNED MESSAGE-----" ] || \ | > >+ [ "$(head -n 1 \"$1\")" = "-----BEGIN PGP SIGNED MESSAGE-----" ] || \ | > | > Bzzt, wrong. | > | > $ foo=/etc/ld.so.conf; echo "`head -n 1 \"$foo\"`" | > include /etc/ld.so.conf.d/*.conf | > | > $ foo=/etc/ld.so.conf; echo "$(head -n 1 \"$1\")" | > head: cannot open `""' for reading: No such file or directory | | fwiw, it breaks even if you remember to use the right variable in the | second example... ;-) | | $ foo=/etc/ld.so.conf; echo "$(head -n 1 \"$foo\")" | head: cannot open `"/etc/ld.so.conf"' for reading: No such file or directory
One of the benfits of POSIX command substitution is also, that there is no need for extra quoting: $ foo=/etc/ld.so.conf; echo "$(head -n 1 "$foo")" include /etc/ld.so.conf.d/*.conf The $() is interepreted first, so the echo quotes are not affected. Jari -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org