Imported from ../bash-2.02.tar.gz.
[platform/upstream/bash.git] / tests / dollar-at-star
1 # first, let's start with the basics
2
3 recho "$@"
4 recho "$*"
5
6 recho $@
7 recho $*
8
9 set a b
10
11 recho "$*"
12
13 # If IFS is null, the parameters are joined without separators
14 IFS=''
15 recho "$*"
16
17 # If IFS is unset, the parameters are separated by spaces
18 unset IFS
19 recho "${*}"
20
21 recho "$@"
22 recho $@
23
24 IFS='/'
25 set bob 'tom dick harry' joe
26 set $*
27 recho $#
28 recho $1
29 recho $2
30 recho $3
31
32 set bob 'tom dick harry' joe
33 set ${*}
34 recho $#
35 recho $1
36 recho $2
37 recho $3
38
39 set bob 'tom dick harry' joe
40 set $@
41 recho $#
42 recho $1
43 recho $2
44 recho $3
45
46 set bob 'tom dick harry' joe
47 set ${@}
48 recho $#
49 recho $1
50 recho $2
51 recho $3
52
53 # according to POSIX.2, unquoted $* should expand to multiple words if
54 # $IFS is null, just like unquoted $@
55 IFS=''
56 set bob 'tom dick harry' joe
57 set $*
58 recho $#
59 recho $1
60 recho $2
61 recho $3
62
63 set bob 'tom dick harry' joe
64 set $@
65 recho $#
66 recho $1
67 recho $2
68 recho $3
69
70 # if IFS is unset, the individual positional parameters are split on
71 # " \t\n" if $* or $@ are unquoted
72 unset IFS
73 set bob 'tom dick harry' joe
74 set $*
75 recho $#
76 recho $1
77 recho $2
78 recho $3
79
80 set bob 'tom dick harry' joe
81 set $@  
82 recho $#                                              
83 recho $1
84 recho $2
85 recho $3
86
87 # but not for "$@" or "$*"
88 set bob 'tom dick harry' joe
89 set "$*"
90 recho $#
91 recho $1
92 recho $2
93 recho $3
94
95 set bob 'tom dick harry' joe
96 set "$@"
97 recho $#
98 recho $1
99 recho $2
100 recho $3
101
102 # POSIX.2 says these should both expand the positional parameters
103 # to multiple words
104 set a b c d e
105 IFS=""
106 recho $@
107 recho "$@"
108
109 # this example is straight from the POSIX.2 rationale
110 set foo bar bam
111
112 recho "$@"
113 recho "$*"
114
115 unset IFS
116
117 recho "$@"
118 recho $@
119 recho "$*"