source:http://www.fvue.nl/wiki/Bash:_Show_IFS_value
Problem
How do I check the value of the IFS (Internal Field Separator) variable? The default value is space, tab and newline so
echo $IFS
would show me just whitespace...Solution 1: od
$ echo -n "$IFS" | od -abc 0000000 sp ht nl 040 011 012 \t \n 0000003
Solution 2: cat
$ echo -n "$IFS" | cat -vTE ^I$
Restore default IFS
$ IFS=$' \t\n'
Backup and restore IFS
$ OLDIFS=$IFS IFS=$'\n' $ # do something $ IFS=$OLDIFS
댓글
댓글 쓰기