name: IFS-space-1 description: Simple test, default IFS stdin: showargs() { for i; do echo -n " <$i>"; done; echo; } set -- A B C showargs 1 $* showargs 2 "$*" showargs 3 $@ showargs 4 "$@" expected-stdout: <1> <2> <3> <4> --- name: IFS-colon-1 description: Simple test, IFS=: stdin: showargs() { for i; do echo -n " <$i>"; done; echo; } IFS=: set -- A B C showargs 1 $* showargs 2 "$*" showargs 3 $@ showargs 4 "$@" expected-stdout: <1> <2> <3> <4> --- name: IFS-null-1 description: Simple test, IFS="" stdin: showargs() { for i; do echo -n " <$i>"; done; echo; } IFS="" set -- A B C showargs 1 $* showargs 2 "$*" showargs 3 $@ showargs 4 "$@" expected-stdout: <1> <2> <3> <4> --- name: IFS-space-colon-1 description: Simple test, IFS=: stdin: showargs() { for i; do echo -n " <$i>"; done; echo; } IFS="$IFS:" set -- showargs 1 $* showargs 2 "$*" showargs 3 $@ showargs 4 "$@" showargs 5 : "$@" expected-stdout: <1> <2> <> <3> <4> <5> <:> --- name: IFS-space-colon-2 description: Simple test, IFS=: At&t ksh fails this, POSIX says the test is correct. stdin: showargs() { for i; do echo -n " <$i>"; done; echo; } IFS="$IFS:" set -- showargs :"$@" expected-stdout: <:> --- name: IFS-space-colon-3 description: Simple test, IFS=: pdksh fails both of these tests stdin: showargs() { for i; do echo -n " <$i>"; done; echo; } IFS="$IFS:" x= set -- showargs "$x$@" showargs "$@$x" expected-fail: yes expected-stdout: <> <> --- name: IFS-space-colon-4 description: Simple test, IFS=: stdin: showargs() { for i; do echo -n " <$i>"; done; echo; } IFS="$IFS:" set -- showargs "$@$@" expected-stdout: --- name: IFS-space-colon-5 description: Simple test, IFS=: Don't know what POSIX thinks of this. at&t ksh does not do this. stdin: showargs() { for i; do echo -n " <$i>"; done; echo; } IFS="$IFS:" set -- showargs "${@:-}" expected-stdout: <> --- name: IFS-subst-1 description: Simple test, IFS=: stdin: showargs() { for i; do echo -n " <$i>"; done; echo; } IFS="$IFS:" x=":b: :" echo -n '1:'; for i in $x ; do echo -n " [$i]" ; done ; echo echo -n '2:'; for i in :b:: ; do echo -n " [$i]" ; done ; echo showargs 3 $x showargs 4 :b:: x="a:b:" echo -n '5:'; for i in $x ; do echo -n " [$i]" ; done ; echo showargs 6 $x x="a::c" echo -n '7:'; for i in $x ; do echo -n " [$i]" ; done ; echo showargs 8 $x echo -n '9:'; for i in ${FOO-`echo -n h:i`th:ere} ; do echo -n " [$i]" ; done ; echo showargs 10 ${FOO-`echo -n h:i`th:ere} showargs 11 "${FOO-`echo -n h:i`th:ere}" expected-stdout: 1: [] [b] [] 2: [:b::] <3> <> <> <4> <:b::> 5: [a] [b] <6> 7: [a] [] [c] <8> <> 9: [h] [ith] [ere] <10> <11> --- name: IFS-subst-2 description: manual page test, IFS=: stdin: showargs() { for i; do echo -n " <$i>"; done; echo; } IFS=" :" x=" A : B::D" echo -n '1:'; for i in $x ; do echo -n " [$i]" ; done ; echo showargs 2 $x expected-stdout: 1: [A] [B] [] [D] <2> <> ---