help-bash
[Top][All Lists]
Advanced

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

[Help-bash] Is read -d '' officially supported?


From: Ulrich Mueller
Subject: [Help-bash] Is read -d '' officially supported?
Date: Sun, 30 Oct 2016 12:57:46 +0100

While discussing some updates for the Gentoo developer manual, the
question arose if a construct like the following is officially
supported Bash behaviour:

    while IFS="" read -d '' -r f ; do
        echo "Calling down holy vengance upon $f"
    done < <(find "${S}" -type f -print0)

Apparently "read -d ''" or "read -d $'\0'" have some real-world use:
http://unix.stackexchange.com/questions/61029/why-is-0-the-same-as
http://stackoverflow.com/questions/8677546/bash-for-in-looping-on-null-delimited-string-variable

However, according to the documentation:

     '-d DELIM'
          The first character of DELIM is used to terminate the input
          line, rather than newline.

An empty string has no first character, so strictly speaking -d ''
would be undefined behaviour?



reply via email to

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