1#   This program is free software: you can redistribute it and/or modify
2#   it under the terms of the GNU General Public License as published by
3#   the Free Software Foundation, either version 3 of the License, or
4#   (at your option) any later version.
5#
6#   This program is distributed in the hope that it will be useful,
7#   but WITHOUT ANY WARRANTY; without even the implied warranty of
8#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
9#   GNU General Public License for more details.
10#
11#   You should have received a copy of the GNU General Public License
12#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
13#
14OIFS="$IFS"
15IFS=":$IFS"
16eval foo="a:b:c"
17IFS="$OIFS"
18echo $foo
19
20OIFS=$IFS
21IFS=":$IFS"
22foo=$(echo a:b:c)
23IFS=$OIFS
24
25for i in $foo
26do
27	echo $i
28done
29
30OIFS=$IFS
31IFS=":$IFS"
32foo=`echo a:b:c`
33IFS=$OIFS
34
35for i in $foo
36do
37	echo $i
38done
39
40DEFIFS=$' \t\n'
41
42# local copy of IFS that shadows global version
43function f
44{
45	typeset IFS=:
46
47	echo $1
48}
49
50function ff
51{
52	echo $1
53}
54
55f a:b:c:d:e
56x=a:b:c:d:e
57echo $x
58
59IFS=: ff a:b:c:d:e
60echo $x
61
62# doesn't get word split
63IFS=$DEFIFS
64# variable assignment doesn't use new value for word splitting
65IFS=: echo $x
66# but does this time because of the eval
67IFS=: eval echo \$x
68
69# in posix mode, assignments preceding special builtins and functions are global
70set -o posix
71IFS=: export x
72echo $x
73
74IFS="$DEFIFS"
75
76${THIS_SH} ./ifs1.sub
77