3 ms·
Hm, is that true? When I run this script: #!/bin/bash items=( 'a' 'b c' "d\te" "f\ng" ) echo "Unquoted:" for item in ${ite
by redsymbol 12y ago
Hm, is that true? When I run this script:
#!/bin/bash
items=(
'a'
'b c'
"d\te"
"f\ng"
)
echo "Unquoted:"
for item in ${items[@]}; do
echo -e ". $item"
done
echo "Quoted:"
for item in "${items[@]}"; do
echo -e ". $item"
done
set -euo pipefail
IFS=$'\n\t'
echo "Unquoted strict mode:"
for item in ${items[@]}; do
echo -e ". $item"
done
... I get this output:
Unquoted:
. a
. b
. c
. d e
. f
g
Quoted:
. a
. b c
. d e
. f
g
Unquoted strict mode:
. a
. b c
. d e
. f
g
Note the output for "Quoted" and "Unquoted strict mode" are identical.
(GNU bash, version 4.2.37(1)-release (x86_64-pc-linux-gnu))