bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Decimal point or decimal comma


From: Andreas Schwab
Subject: Re: Decimal point or decimal comma
Date: Mon, 10 Aug 2009 22:53:23 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)

address@hidden (Paul Jarc) writes:

> Pierre Gaston <address@hidden> wrote:
>> 2) eval can also be dangerous used like this, as it permits to pass
>> arbitrary code that will be executed by the script
>
> Oops, I missed some backslashes:
> #!/bin/sh
> "eval" "exec gawk --use-lc-numeric -f \"\$0\" \${1+\"address@hidden"}" && 0
> ... gawk code, which the shell won't see ...
>
> But now gawk complains about \$.  I'm not sure how to get around that.

How about this:

#!/bin/sh
"exec" "gawk" "--use-lc-numeric" "-f" "$0" "$@" && 0

It requires a sane shell (for "$@"), but otherwise should work better.

Andreas.

-- 
Andreas Schwab, address@hidden
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."




reply via email to

[Prev in Thread] Current Thread [Next in Thread]