When using MBFL we want to be aware of the following:
alpha=$beta alpha=${beta:1:3} alpha=${beta:-$gamma} alpha=${#beta}
There is also no word splitting when evaluating the WORD in the case
statement; so
there is no need to use double quotes in the following case:
case $WORD in ... esac
p_
. It
is guaranteed that MBFL never uses variables with name starting with such a prefix.
read
built in does word splitting on the text it reads, even when there is a single
output variable. We can verify it with:
printf '\tciao\n' | { read line echo line was "'$line'" } -| line was 'ciao'
we see that the initial tabulation character has been stripped, because it is a character in the
default value of IFS
. Word splitting does not happen when we set IFS
to the empty
string:
printf '\tciao\n' | { IFS= read line echo line was "'$line'" } -| line was ' ciao'
To avoid the mutation of text read with read
, MBFL always sets IFS
to the empty
string in the environment in which read
is evaluated. This happens in functions like
mbfl_read_maybe_null()
and mbfl_dialog_ask_password()
; notice, though, that these
functions do not mutate the IFS
value in the environment of the caller.
This document describes version 3.0.0-devel.9 of Marcos Bash Functions Library.