On Mon, Nov 28, 2011 at 03:57:19PM +0100, Ulrich Windl wrote:
> >>> Florian Haas <flor...@hastexo.com> schrieb am 28.11.2011 um 15:05 in 
> >>> Nachricht
> <capuexz9bm3suof0fteqvbjcpyo9rlz9gazk3mc5td8oyosi...@mail.gmail.com>:
> > On Mon, Nov 28, 2011 at 2:58 PM, Dejan Muhamedagic <deja...@fastmail.fm> 
> > wrote:
> > >> Why? It seems "typeset" is the POSIX thing, while "local" is a BASH-ism. 
> > >> So 
> > what's wrong with local variables?
> > >
> > > local is almost certainly not a bashism. At least I can recall
> > > once changing typeset to local in some RA.
> > 
> > IIRC, then "local foo=bar" is a bashism, whereas "local foo; foo=bar"
> > is POSIX compliant. At least that's what checkbashisms seems to
> > indicate.
> 
> Hmmm: HP-UX POSIX Shell uses "typeset -i e=0", and I always thought that's 
> just POSIX.

AFAIK, neither typeset nor declare nor local is POSIX (yet) (that should
be true for about half a year ago, at least). thers is indeed talk to
make this POSIX, possibly indeed standardized on the name "typeset".

Yes, well, kornshell knows about typeset,
and does not know declare nor local (or has that changed?). 
But ksh is rarely used as /bin/sh.

Bash knows about all three, but "deprecates" typeset in favor of
declare, where both are synonyms in the internal implementation.


Besides, what we care for here is not what is written in some standard
(yet to come), but the real world, and that real world looks like this:

dash -c 'typeset X=1 ; echo $X'
dash: typeset: not found

dash -c 'declare X=1 ; echo $X'
dash: declare: not found

dash -c 'local X=1 ; echo $X'
1

Where dash is the only "relevant" thing frequently used as /bin/sh
again: afaik.

So as long as you keep the agent #!/bin/sh,
make sure it works with dash.


-- 
: Lars Ellenberg
: LINBIT | Your Way to High Availability
: DRBD/HA support and consulting http://www.linbit.com
_______________________________________________
Linux-HA mailing list
Linux-HA@lists.linux-ha.org
http://lists.linux-ha.org/mailman/listinfo/linux-ha
See also: http://linux-ha.org/ReportingProblems

Reply via email to