a34b05d2e6
This opens an OpenBSD-mirabile (aka MirBSD) repository. ### MirBSD is: # Copyright (c) 1982-2003 by Thorsten "mirabile" Glaser <x86@ePost.de> # Copyright © 1968-2003 The authors of And contributors to UNIX®, the # C Language, BSD/Berkeley Unix; 386BSD, NetBSD 1.1 and OpenBSD. # # Anyone who obtained a copy of this work is hereby permitted to freely use, # distribute, modify, merge, sublicence, give away or sell it as long as the # authors are given due credit and the following notice is retained: # # This work is provided "as is", with no explicit or implicit warranty what- # soever. Use it only at your own risk. In no event may an author or contri- # butor be held liable for any damage, directly or indirectly, that origina- # ted through or is caused by creation or modification of this work. MirBSD is my private tree. MirBSD does not differ very much from OpenBSD and intentionally tracks OpenBSD. That's why it _is_ OpenBSD, just not the official one. It's like with DarrenBSD. At time of this writing, no advertising for MirBSD must be done, because the advertising clause has not yet been sorted out. http://templeofhate.com/tglaser/MirBSD/index.php
163 lines
2.9 KiB
Raku
163 lines
2.9 KiB
Raku
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> <A> <B> <C>
|
|
<2> <A B C>
|
|
<3> <A> <B> <C>
|
|
<4> <A> <B> <C>
|
|
---
|
|
|
|
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> <A> <B> <C>
|
|
<2> <A:B:C>
|
|
<3> <A> <B> <C>
|
|
<4> <A> <B> <C>
|
|
---
|
|
|
|
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> <A B C>
|
|
<2> <ABC>
|
|
<3> <A B C>
|
|
<4> <A B C>
|
|
---
|
|
|
|
name: IFS-space-colon-1
|
|
description:
|
|
Simple test, IFS=<white-space>:
|
|
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=<white-space>:
|
|
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=<white-space>:
|
|
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=<white-space>:
|
|
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=<white-space>:
|
|
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=<white-space>:
|
|
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> <> <b> <> <>
|
|
<4> <:b::>
|
|
5: [a] [b] []
|
|
<6> <a> <b> <>
|
|
7: [a] [] [c]
|
|
<8> <a> <> <c>
|
|
9: [h] [ith] [ere]
|
|
<10> <h> <ith> <ere>
|
|
<11> <h:ith:ere>
|
|
---
|
|
|