[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: sh portability questions
From: |
Ralf Wildenhues |
Subject: |
Re: sh portability questions |
Date: |
Wed, 28 Sep 2005 10:30:02 +0200 |
User-agent: |
Mutt/1.5.11 |
* Akim Demaille wrote on Wed, Sep 28, 2005 at 09:51:23AM CEST:
>
> I can actually define "local" to do nothing and use an external
> maintainer-check to grep'n check them.
>
> Also, maybe I am paranoid, but would you trust shells to support
> conditional function definitions? Or function definitions in eval?
>
> if (local foo) >/dev/null 2>&1; then :; else
> local () { true; }
> fi
>
> or even
>
> (local foo) >/dev/null 2>&1 || local () { true; }
You'd have to forbid
local foo=bar
then. (I guess you didn't want to use it anyway.)
Hmm, if it weren't for quoting issues, you could use
local ()
{
for l
do
case $l in *=*) eval "$l";; esac
done
}
but quoting kills that, unfortunately, and func_quote_for_eval
might be way overkill here.
Cheers,
Ralf