summaryrefslogtreecommitdiff
path: root/shell/hush_test/hush-vars/var_wordsplit_ifs1.tests
blob: a62afc6fd2ee3eef7cf38e96c1595da5bf1a2ed8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
set -- abc "d e"

echo 'Testing: !IFS $*'
unset IFS; for a in $*; do echo ".$a."; done
echo 'Testing: !IFS $@'
unset IFS; for a in $@; do echo ".$a."; done
echo 'Testing: !IFS "$*"'
unset IFS; for a in "$*"; do echo ".$a."; done
echo 'Testing: !IFS "$@"'
unset IFS; for a in "$@"; do echo ".$a."; done

echo 'Testing: IFS="" $*'
IFS=""; for a in $*; do echo ".$a."; done
echo 'Testing: IFS="" $@'
IFS=""; for a in $@; do echo ".$a."; done
echo 'Testing: IFS="" "$*"'
IFS=""; for a in "$*"; do echo ".$a."; done
echo 'Testing: IFS="" "$@"'
IFS=""; for a in "$@"; do echo ".$a."; done

echo 'Testing: !IFS v=$*'
unset IFS; v=$*; echo "v='$v'"
echo 'Testing: !IFS v=$@'
unset IFS; v=$@; echo "v='$v'"
echo 'Testing: !IFS v="$*"'
unset IFS; v="$*"; echo "v='$v'"
echo 'Testing: !IFS v="$@"'
unset IFS; v="$@"; echo "v='$v'"

echo 'Testing: IFS="" v=$*'
IFS=""; v=$*; echo "v='$v'"
echo 'Testing: IFS="" v=$@'
IFS=""; v=$@; echo "v='$v'"
echo 'Testing: IFS="" v="$*"'
IFS=""; v="$*"; echo "v='$v'"
echo 'Testing: IFS="" v="$@"'
IFS=""; v="$@"; echo "v='$v'"

# Note: in IFS="" v=$@ and IFS="" v="$@" cases, bash produces "abc d e"
# We produce "abcd e"

echo Finished