# HG changeset patch # User František Kučera <franta-hg@frantovo.cz> # Date 1578770683 -3600 # Node ID e73765513aecefe2ef07522baa2a27addd89f5d5 # Parent 34a7c4e318b3688f4ab47a9ef5645e626a7cf7ed fix read_nullbyte() to avoid trimming whitespace diff -r 34a7c4e318b3 -r e73765513aec relpipe-data/examples-in-xmltable-xhtml-outline.xml --- a/relpipe-data/examples-in-xmltable-xhtml-outline.xml Sat Jan 04 20:21:45 2020 +0100 +++ b/relpipe-data/examples-in-xmltable-xhtml-outline.xml Sat Jan 11 20:24:43 2020 +0100 @@ -113,7 +113,7 @@ <m:pre jazyk="bash"><![CDATA[# our favorite function used also in other examples; # reads values separated by a \0 byte into a variable; # this is a safer way than a space or newline separated data: -read_nullbyte() { for v in "$@"; do export "$v"; read -r -d '' "$v"; done } +read_nullbyte() { local IFS=; for v in "$@"; do export "$v"; read -r -d '' "$v"; done } wget -O - http://blog.frantovo.cz/ \ | relpipe-in-xmltable \ diff -r 34a7c4e318b3 -r e73765513aec relpipe-data/examples-out-bash.xml --- a/relpipe-data/examples-out-bash.xml Sat Jan 04 20:21:45 2020 +0100 +++ b/relpipe-data/examples-out-bash.xml Sat Jan 11 20:24:43 2020 +0100 @@ -19,7 +19,7 @@ We will define a function that will help us with reading the <code>\0</code>-separated values and putting them into shell variables: </p> - <m:pre jazyk="bash"><![CDATA[read_nullbyte() { for v in "$@"; do export "$v"; read -r -d '' "$v"; done }]]></m:pre> + <m:pre jazyk="bash"><![CDATA[read_nullbyte() { local IFS=; for v in "$@"; do export "$v"; read -r -d '' "$v"; done }]]></m:pre> <!-- This version will not require the last \0: