leafee98-blog/content/posts/shell-expansions/word-split.sh
2023-02-03 22:24:18 +08:00

19 lines
313 B
Bash

#!/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