leafee98-blog/content/posts/shell-expansions/word-split.sh

19 lines
313 B
Bash
Raw Normal View History

2023-02-03 14:24:18 +00:00
#!/usr/bin/env bash
IFS=$' \t\n'
a="$(printf " a b , c d\n\t e f ")"
printf "a = "
printf "$a" | xxd
for i in $a ; do printf "$i" | xxd ; done
IFS=$'\t\n'
for i in $a ; do printf "$i" | xxd ; done
IFS=$', \t\n'
for i in $a ; do printf "$i" | xxd ; done
IFS=$', \n'
for i in $a ; do printf "$i" | xxd ; done