* lisp/progmodes/sh-script.el (sh-smie-sh-rules): For { after &&, don't
[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
b08b6da7
SM
44echo -n $(( 5 << 2 ))
45# This should not be treated as a heredoc (bug#12770).
462
47
3618df45
SM
48foo='bar<<' # bug#11263
49echo ${foo%<<aa} # bug#11263
50echo $((1<<8)) # bug#11263
51echo $[1<<8] # bug#11263
52
efc26dbe
SM
53declare -a VERSION
54for i in $(ls "$PREFIX/sbin") ; do
55 echo -e $N')' $i
dee4ba59 56 VERSION[${#VERSION[*]}]=$i # bug#11946.
efc26dbe
SM
57 N=$(($N + 1))
58done
59
ccded26c
SM
60foo () {
61
62 bar () {
63 blilbi
64 }
65
66 case toto
67 in a) hello # KNOWN INDENT BUG
68 ;; b) hi # KNOWN INDENT BUG
461ef3c5 69 ;; c) hi # KNOWN INDENT BUG
ccded26c
SM
70 esac
71
72 case $toto in
73 a) echo 1;; b) echo 2;;
d7f9cc85
SM
74 (c)
75 echo 3;;
76 d)
77 echo 3;;
ccded26c
SM
78 esac
79
80 case $as_nl`(ac_space=' '; set) 2>&1` in #(
81 *${as_nl}ac_space=\ *)
82 # `set' does not quote correctly, so add quotes: double-quote
83 # substitution turns \\\\ into \\, and sed turns \\ into \.
84 sed -n \
85 "s/'/'\\\\''/g;
86 s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=/\\1=''/p"
87 ;; #(
88 *)
89 # `set' quotes correctly as required by POSIX, so do not add
90 # quotes.
91 sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
92 ;;
93 esac |
461ef3c5
SM
94 grep '.' | # KNOWN INDENT BUG
95 sed 1d
ccded26c
SM
96
97 case toto in
98 -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
99 | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* \
100 | --exec=* | --exe=* | --ex=*)
101 exec_prefix=$ac_optarg ;;
102 5)
103 hello ;;
104 3) hello $(adfad)
105 echo esac ;; # KNOWN INDENT BUG
106 5) hello ;;
107 4) hello ;&
108 4) hello ;;&
109 5) hello ;;
110 5) hello ;;
111 esac
112
113 echo "'" wfgfe
114
115 #!/bin/bash
116 cat << EOF \
117 | cat sadfsafd \
118 sadfsafd "KNOWN INDENT BUG" \
119 | tee -a bug.txt
120asdfsaf
121This is a test case for a bug in bash shell mode text highlighting
122EOF
123
124 cat <<EOF1 <<EOF2 # KNOWN INDENT BUG
125help1
126EOF1
127help2
128EOF2
129}
130bar () {
131 if [ $# == 0 ]; then
132 while
133 f # KNOWN INDENT BUG
134 do
135 bla;
136 done
137 echo "Highlighting is screwed up now"
138 if [ 1 = 1 ]; then
139 # adsgsdg
140 echo "screwed up"
141 fi
142
143 $@ $? $#
144
145 for f in *
146 do
147 sdfg
148 done
149
150 if swrgfef
151 then blas
152 else sdf
153 fi
154
155 fi
156}