Re: sh portability questions

2005-09-28 Thread Ralf Wildenhues
Just a couple of random thoughts: * Paul Eggert wrote on Wed, Sep 28, 2005 at 12:36:06AM CEST: > Andreas Schwab <[EMAIL PROTECTED]> writes: > > Paul Eggert <[EMAIL PROTECTED]> writes: > > > >> Assuming you don't need recursion, here's a thought. I believe this is a decent assumption for the funct

Re: sh portability questions

2005-09-28 Thread Akim Demaille
>>> "Paul" == Paul Eggert <[EMAIL PROTECTED]> writes: > "local" isn't in POSIX so I'd avoid it in portable scripts. Doh. Thanks. > For what it's worth, I briefly searched for this issue and found these > bug reports dated this year where someone used "local" in a shell > script and someone

Re: sh portability questions

2005-09-28 Thread Paul Eggert
Akim Demaille <[EMAIL PROTECTED]> writes: > Also, maybe I am paranoid, but would you trust shells to support > conditional function definitions? Or function definitions in eval? No, you're not paranoid. But I think I would trust it, yes. Admittedly it might take some iterations to get the test

Re: sh portability questions

2005-09-28 Thread Ralf Wildenhues
* 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 definiti

Re: sh portability questions

2005-09-28 Thread Andreas Schwab
Akim Demaille <[EMAIL PROTECTED]> writes: > if (local foo) >/dev/null 2>&1; then :; else > local () { true; } > fi Note that local is only valid in function context, so this will always produce a failure. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Max

Re: sh portability questions

2005-09-28 Thread Akim Demaille
>>> "Andreas" == Andreas Schwab <[EMAIL PROTECTED]> writes: > Akim Demaille <[EMAIL PROTECTED]> writes: >> if (local foo) >/dev/null 2>&1; then :; else >> local () { true; } >> fi > Note that local is only valid in function context, so this will always > produce a failure. Thanks, I didn'

Re: configure wrongly caches results

2005-09-28 Thread Ralf Wildenhues
Hi Patrice, Stepan, * Stepan Kasal wrote on Tue, Sep 27, 2005 at 10:23:05AM CEST: > On Mon, Sep 26, 2005 at 12:51:53AM +0200, Patrice Dumas wrote: > > So it seems that there is a kind of caching that cannot be disabled and > > that is preventing such tests to work. > > Indeed, you can switch off

Re: sh portability questions

2005-09-28 Thread Ralf Wildenhues
* Akim Demaille wrote on Wed, Sep 28, 2005 at 01:36:11PM CEST: > > Thanks, I didn't know. How about this then? > ( > foo=bar > test_local () { > local foo=foo > } > test_local > test $foo = bar > ) || local () { > case $1 in > *=*) eval "$1";; > esac >