Fix some indentation problem with \; and pipes.
[bpt/emacs.git] / test / indent / shell.sh
CommitLineData
ccded26c 1#!/bin/sh
efc26dbe 2# -*- eval: (bug-reference-mode 1) -*-
ccded26c
SM
3
4setlock -n /tmp/getmail.lock && echo getmail isn\'t running
5
6# adsgsdg
7
85527ff3
SM
8if foo; then
9 if bar; then
10 toto
11 fi
12fi # bug#15613
13
4a74c818
SM
14case $X in
15 foo)
16 do_something
17 ;;
18 arg=*) # bug#12953
19 do_something_else_based_on_arg
20 ;;
21 *)
22 default
23 ;;
24esac
25
e9638b49
SM
26{ # bug#17621
27 foo1 &&
500dce5f
SM
28 foo2 &&
29 bar
30
31 foo1 && \
32 foo2 && \
e9638b49
SM
33 bar
34}
35
9e248ebd
SM
36for foo in bar; do # bug#17721
37 [ -e $foo ] && {
38 echo t
39 } && {
40 echo r
41 }
42done
43
370ceb22
SM
44filter_3 () # bug#17842
45{
46 tr -d '"`' | tr ' ' ' ' | \
47 awk -F\; -f filter.awk | \
48 grep -v "^," | sort -t, -k2,2
49}
50
b08b6da7
SM
51echo -n $(( 5 << 2 ))
52# This should not be treated as a heredoc (bug#12770).
532
54
3618df45
SM
55foo='bar<<' # bug#11263
56echo ${foo%<<aa} # bug#11263
57echo $((1<<8)) # bug#11263
58echo $[1<<8] # bug#11263
59
efc26dbe
SM
60declare -a VERSION
61for i in $(ls "$PREFIX/sbin") ; do
62 echo -e $N')' $i
dee4ba59 63 VERSION[${#VERSION[*]}]=$i # bug#11946.
efc26dbe
SM
64 N=$(($N + 1))
65done
66
ccded26c
SM
67foo () {
68
69 bar () {
70 blilbi
71 }
72
73 case toto
74 in a) hello # KNOWN INDENT BUG
75 ;; b) hi # KNOWN INDENT BUG
461ef3c5 76 ;; c) hi # KNOWN INDENT BUG
ccded26c
SM
77 esac
78
79 case $toto in
80 a) echo 1;; b) echo 2;;
d7f9cc85
SM
81 (c)
82 echo 3;;
83 d)
84 echo 3;;
ccded26c
SM
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 |
461ef3c5
SM
101 grep '.' | # KNOWN INDENT BUG
102 sed 1d
ccded26c
SM
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
127asdfsaf
128This is a test case for a bug in bash shell mode text highlighting
129EOF
130
131 cat <<EOF1 <<EOF2 # KNOWN INDENT BUG
132help1
133EOF1
134help2
135EOF2
136}
137bar () {
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}