Mailinglist Archive: radeonhd (529 mails)
| < Previous | Next > |
Re: [radeonhd] [PATCH 2/2] Get rid of another potential quoting problem
- From: Hans Ulrich Niedermann <hun@xxxxxxxxxxxxxxxx>
- Date: Tue, 04 Dec 2007 18:51:12 +0100
- Message-id: <47559390.4030204@xxxxxxxxxxxxxxxx>
Matthias Hopf wrote:
$(cmd) is not a bashism. $(cmd) is POSIX sh, and is supported by most
shs even if they are not strictly POSIX in other ways.
The one sh that does not grok $(cmd) is the Solaris /bin/sh. However,
Solaris has a working sh in /usr/iforgotwhatitwaswith4/bin/sh, so they
can just SHELL=/usr/iforgotwhatitwaswith4/bin/sh and it will work for them.
Correct quoting with $() is easy (for file and directory names with
spaces e.g.). Correct quoting and escaping with `` frankly escapes me,
though, and IIRC there were some things that could not be quoted
correctly at all with ``. You're welcome to help me there, of course.
I personally think the benefits of the correct nesting and quoting of
$() far outweigh that users of the single system with the
broken-by-default sh have to explicitly specify the functional sh that
is sitting just two directories away.
E.g. git's scripts use sh functions and $() substitution.
--
Hans Ulrich Niedermann
On Dec 01, 07 02:44:09 +0100, Hans Ulrich Niedermann wrote:
working_dir="$(pwd)"
Just as I see this - $(cmd) is a bash extension AFAIK. Better use
"`cmd`".
$(cmd) is not a bashism. $(cmd) is POSIX sh, and is supported by most
shs even if they are not strictly POSIX in other ways.
The one sh that does not grok $(cmd) is the Solaris /bin/sh. However,
Solaris has a working sh in /usr/iforgotwhatitwaswith4/bin/sh, so they
can just SHELL=/usr/iforgotwhatitwaswith4/bin/sh and it will work for them.
Correct quoting with $() is easy (for file and directory names with
spaces e.g.). Correct quoting and escaping with `` frankly escapes me,
though, and IIRC there were some things that could not be quoted
correctly at all with ``. You're welcome to help me there, of course.
I personally think the benefits of the correct nesting and quoting of
$() far outweigh that users of the single system with the
broken-by-default sh have to explicitly specify the functional sh that
is sitting just two directories away.
E.g. git's scripts use sh functions and $() substitution.
--
Hans Ulrich Niedermann
| < Previous | Next > |