]> git.ipfire.org Git - thirdparty/bash.git/blob - tests/array10.sub
bash-5.1 distribution sources and documentation
[thirdparty/bash.git] / tests / array10.sub
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 #
14 days=({Mon,Tues,Wednes,Thurs,Fri,Satur,Sun}day)
15 echo ${days[@]}
16
17 typeset -i count
18
19 count=0
20 echo ${days[${count}]}
21 echo ${days[$((count++))]}
22 echo ${days[$((count++))]}
23
24 count=0
25 echo ${days[count]}
26 echo ${days[count++]}
27 echo ${days[count++]}
28
29 count=0
30 echo ${days[$((count++))]/foo/bar}
31 echo ${days[$((count++))]/foo/bar}
32 echo ${days[$((count++))]/foo/bar}
33
34 count=0
35 echo ${days[count++]/foo/bar}
36 echo ${days[count++]/foo/bar}
37 echo ${days[count++]/foo/bar}
38
39 count=0
40 echo "${days[${count}],,}, ${days[$((count++))],,}, ${days[$((count++))],,}"
41 echo "${days[${count}],,}, ${days[$((count++))],,}, ${days[$((count++))],,}"
42
43 count=0
44 echo "${days[${count}],,}, ${days[$((count++))],,}, ${days[$((count++))],,}"
45 echo "${days[${count}]/foo/bar}, ${days[$((count++))]/foo/bar}, ${days[$((count++))]/foo/bar}"
46
47 count=0
48 echo ${days[$((count++))]:2}
49 echo ${days[$((count++))]:2}
50 echo ${days[$((count++))]:2}
51
52 count=0
53 echo ${days[count++]:2}
54 echo ${days[count++]:2}
55 echo ${days[count++]:2}
56
57 count=0
58 echo ${days[$((count++))]#?}
59 echo ${days[$((count++))]#?}
60 echo ${days[$((count++))]#?}
61
62 count=0
63 echo ${days[count++]#?}
64 echo ${days[count++]#?}
65 echo ${days[count++]#?}