Package: posh
Version: 0.6.7
Severity: normal

$ f() { echo $a; }
$ a=1 f
1
$ echo $a
1


If I read SUSv3 correctly, the echo statement shouldn't have output "1".

Now it's true that in cases like:

$ ksh93 -c 'f() { a=2; }; a=1 f; echo $a'
2
$ bash -c 'f() { a=2; }; a=1 f; echo $a'

$ pdksh -c 'f() { a=2; }; a=1 f; echo $a'
1
$ ash -c 'f() { a=2; }; a=1 f; echo $a'
2
$ posh -c 'f() { a=2; }; a=1 f; echo $a'
2
$ zsh -c 'f() { a=2; }; a=1 f; echo $a'

$

there's not much consensus.

bash and zsh seem to implement a stack as if the variable was
declared as "local" in the function. It seems to be what POSIX
requires so that it would be a way to have a local scope in a
function (could be used with "command ." and "command eval" I
guess as well).

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.25-rc8 (PREEMPT)
Locale: LANG=en_GB.ISO-8859-15, LC_CTYPE=en_US.ISO-8859-15 (charmap=ISO-8859-15)
Shell: /bin/sh linked to /bin/bash

Versions of packages posh depends on:
ii  debconf [debconf-2.0]         1.5.22     Debian configuration management sy
ii  libc6                         2.7-11     GNU C Library: Shared libraries

posh recommends no packages.

-- debconf-show failed



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to