4a30739e2d90248462343b83bf2baa26e773088a
[bpt/emacs.git] / test / indent / shell.sh
1 #!/bin/sh
2 # -*- eval: (bug-reference-mode 1) -*-
3
4 setlock -n /tmp/getmail.lock && echo getmail isn\'t running
5
6 # adsgsdg
7
8 if foo; then
9 if bar; then
10 toto
11 fi
12 fi # bug#15613
13
14 case $X in
15 foo)
16 do_something
17 ;;
18 arg=*) # bug#12953
19 do_something_else_based_on_arg
20 ;;
21 *)
22 default
23 ;;
24 esac
25
26 { # bug#17621
27 foo1 &&
28 foo2 &&
29 bar
30
31 foo1 && \
32 foo2 && \
33 bar
34 }
35
36 for foo in bar; do # bug#17721
37 [ -e $foo ] && {
38 echo t
39 } && {
40 echo r
41 }
42 done
43
44 filter_3 () # bug#17842
45 {
46 tr -d '"`' | tr ' ' ' ' | \
47 awk -F\; -f filter.awk | \
48 grep -v "^," | sort -t, -k2,2
49 }
50
51 echo -n $(( 5 << 2 ))
52 # This should not be treated as a heredoc (bug#12770).
53 2
54
55 foo='bar<<' # bug#11263
56 echo ${foo%<<aa} # bug#11263
57 echo $((1<<8)) # bug#11263
58 echo $[1<<8] # bug#11263
59
60 declare -a VERSION
61 for i in $(ls "$PREFIX/sbin") ; do
62 echo -e $N')' $i
63 VERSION[${#VERSION[*]}]=$i # bug#11946.
64 N=$(($N + 1))
65 done
66
67 foo () {
68
69 bar () {
70 blilbi
71 }
72
73 case toto
74 in a) hello # KNOWN INDENT BUG
75 ;; b) hi # KNOWN INDENT BUG
76 ;; c) hi # KNOWN INDENT BUG
77 esac
78
79 case $toto in
80 a) echo 1;; b) echo 2;;
81 (c)
82 echo 3;;
83 d)
84 echo 3;;
85 esac
86
87 case $as_nl`(ac_space=' '; set) 2>&1` in #(
88 *${as_nl}ac_space=\ *)
89 # `set' does not quote correctly, so add quotes: double-quote
90 # substitution turns \\\\ into \\, and sed turns \\ into \.
91 sed -n \
92 "s/'/'\\\\''/g;
93 s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=/\\1=''/p"
94 ;; #(
95 *)
96 # `set' quotes correctly as required by POSIX, so do not add
97 # quotes.
98 sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
99 ;;
100 esac |
101 grep '.' | # KNOWN INDENT BUG
102 sed 1d
103
104 case toto in
105 -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
106 | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* \
107 | --exec=* | --exe=* | --ex=*)
108 exec_prefix=$ac_optarg ;;
109 5)
110 hello ;;
111 3) hello $(adfad)
112 echo esac ;; # KNOWN INDENT BUG
113 5) hello ;;
114 4) hello ;&
115 4) hello ;;&
116 5) hello ;;
117 5) hello ;;
118 esac
119
120 echo "'" wfgfe
121
122 #!/bin/bash
123 cat << EOF \
124 | cat sadfsafd \
125 sadfsafd "KNOWN INDENT BUG" \
126 | tee -a bug.txt
127 asdfsaf
128 This is a test case for a bug in bash shell mode text highlighting
129 EOF
130
131 cat <<EOF1 <<EOF2 # KNOWN INDENT BUG
132 help1
133 EOF1
134 help2
135 EOF2
136 }
137 bar () {
138 if [ $# == 0 ]; then
139 while
140 f # KNOWN INDENT BUG
141 do
142 bla;
143 done
144 echo "Highlighting is screwed up now"
145 if [ 1 = 1 ]; then
146 # adsgsdg
147 echo "screwed up"
148 fi
149
150 $@ $? $#
151
152 for f in *
153 do
154 sdfg
155 done
156
157 if swrgfef
158 then blas
159 else sdf
160 fi
161
162 fi
163 }