[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bash-5.0: problem with variable scoping in posix-mode
From: |
Alexander Tsoy |
Subject: |
bash-5.0: problem with variable scoping in posix-mode |
Date: |
Sun, 27 Jan 2019 15:58:16 +0300 |
Configuration Information:
Machine: x86_64
OS: linux-gnu
Compiler: x86_64-pc-linux-gnu-gcc
Compilation CFLAGS: -O0 -fno-omit-frame-pointer -ggdb -pipe -Wno-
parentheses -Wno-format-security
uname output: Linux gentoo-test 4.14.78-gentoo #1 SMP Wed Oct 24
20:06:13 MSK 2018 x86_64 Westmere E56xx/L56xx/X56xx (IBRS update)
GenuineIntel GNU/Linux
Machine Type: x86_64-pc-linux-gnu
Bash Version: 5.0
Patch Level: 2
Release Status: release
Description:
There is a problem with variable scoping when variable is created from
assignment statement preceding function call in posix-mode. See an
example below.
Repeat-By:
$ cat test.sh
#!/bin/sh
myecho() {
echo $var
}
foo() {
local var="foo: FAIL"
var="foo: bar" myecho
}
foo
$ bash test.sh
foo: bar
$ bash --posix test.sh
foo: FAIL
- bash-5.0: problem with variable scoping in posix-mode,
Alexander Tsoy <=