relpipe-data/examples-out-bash.xml
branchv_0
changeset 290 e73765513aec
parent 244 d4f401b5f90c
equal deleted inserted replaced
289:34a7c4e318b3 290:e73765513aec
    17 		
    17 		
    18 		<p>
    18 		<p>
    19 			We will define a function that will help us with reading the <code>\0</code>-separated values and putting them into shell variables:
    19 			We will define a function that will help us with reading the <code>\0</code>-separated values and putting them into shell variables:
    20 		</p>
    20 		</p>
    21 		
    21 		
    22 		<m:pre jazyk="bash"><![CDATA[read_nullbyte() { for v in "$@"; do export "$v"; read -r -d '' "$v"; done }]]></m:pre>
    22 		<m:pre jazyk="bash"><![CDATA[read_nullbyte() { local IFS=; for v in "$@"; do export "$v"; read -r -d '' "$v"; done }]]></m:pre>
    23 		
    23 		
    24 		<!--
    24 		<!--
    25 			This version will not require the last \0:
    25 			This version will not require the last \0:
    26 				read_zero() { for v in "$@"; do export "$v"; read -r -d '' "$v" || [ ! -z "${!v}" ]; done }
    26 				read_zero() { for v in "$@"; do export "$v"; read -r -d '' "$v" || [ ! -z "${!v}" ]; done }
    27 			at least in case when the last value is not missing.
    27 			at least in case when the last value is not missing.