bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

unexpected behavior with read


From: Zach Hadgraft
Subject: unexpected behavior with read
Date: Sun, 4 Mar 2018 18:15:05 -0500

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: darwin16.7.0
Compiler: clang
Compilation CFLAGS:  -DPROGRAM='bash' -DCONF_HOSTTYPE='x86_64'
-DCONF_OSTYPE='darwin16.7.0' -DCONF_MACHTYPE='x86_64-apple-darwin16.7.0'
-DCONF_VENDOR='apple'
-DLOCALEDIR='/usr/local/Cellar/bash/4.4.19/share/locale' -DPACKAGE='bash'
-DSHELL -DHAVE_CONFIG_H -DMACOSX   -I.  -I. -I./include -I./lib
-I./lib/intl -I/private/tmp/bash-20180209-55597-111ek7c/bash-4.4/lib/intl
-DSSH_SOURCE_BASHRC -Wno-parentheses -Wno-format-security
uname output: Darwin Row-Town-Dander-Fleece.local 16.7.0 Darwin Kernel
Version 16.7.0: Thu Jan 11 22:59:40 PST 2018;
root:xnu-3789.73.8~1/RELEASE_X86_64 x86_64
Machine Type: x86_64-apple-darwin16.7.0

Bash Version: 4.4
Patch Level: 19
Release Status: release

Description:
        global variable assignments fail when part of a sequence that
includes read and begins with a function invoked by command substitution
        read can be invoked by another function, or invoked by another
command and the result is the same

Repeat-By:

"""
#!/bin/bash


r=

f ()
{
    if [ -z "$r" ]; then
        r="x"
        read
    fi
    echo "$r"
}

echo "$(f)"
echo "$(f)"
"""


reply via email to

[Prev in Thread] Current Thread [Next in Thread]