[Top][All Lists]

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

mapfile doesn't accept input from a pipe

From: Keith Thompson
Subject: mapfile doesn't accept input from a pipe
Date: Wed, 28 Jun 2017 19:08:27 -0700

Configuration Information [Automatically generated, do not change]:
Machine: x86_64
OS: linux-gnu
Compiler: gcc
Compilation CFLAGS: -g -O2 -Wno-parentheses -Wno-format-security
uname output: Linux bomb20 4.8.0-46-generic #49-Ubuntu SMP Fri Mar 31
13:57:14 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
Machine Type: x86_64-unknown-linux-gnu

Bash Version: 4.4
Patch Level: 12
Release Status: maint

        The "mapfile" command works correctly if stdin is redirected
from a file, but not if it's from a pipe.
        Demonstrated with several versions including the latest

        This script demonstrates the problem:

        printf 'one\ntwo\nthree\n' > /tmp/input.txt

        mapfile REDIRECT < /tmp/input.txt
        cat /tmp/input.txt | mapfile PIPE

        echo "\$REDIRECT has address@hidden elements"
        echo "\$PIPE     has address@hidden elements"

        if [ address@hidden -eq 3 ] && [ address@hidden -eq 3 ] ; then
            echo PASS
            exit 0
            echo FAIL
            exit 1

reply via email to

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