As you probably already know, the default value of IFS
is <space><tab><newline>
. Using:
echo "$IFS"
you can probably deduce that there is a newline character and some other white space characters, but nothing sure.
To be sure about the exact value of theIFS
variable, you can appeal to the help of cat
command as follow:
echo "$IFS" | cat -ETv
which is equivalent with:
cat -ETv <<< "$IFS"
Sample output for the default value of IFS
:
cat -ETv <<< "$IFS"
^I$
$
From the previous output you can deduce that there sure is one space character at the beginning and a newline character. But what is with the others strange characters. Let's look at the man cat
:
-E, --show-ends
display $ at end of each line
-T, --show-tabs
display TAB characters as ^I
-v, --show-nonprinting
use ^ and M- notation, except for LFD (n.a. linefeed or newline character) and TAB
So, the ^I
sequence from the above output means one TAB character and the other two $
characters means the end of the line.