55f21b5422d563f2d2af5a9f897ba21396d95686
[maemian] / nokia-lintian / testset / maintainer-scripts / debian / prerm
1 #!/bin/sh
2
3 if [ "$1" != "upgrade" ]; then
4        update-alternatives --remove dummy /usr/bin/dummy-alternative
5 fi
6
7 if ([ "$1" = "upgrade" ] || [ "$1" = "remove" ]) && [ -L /usr/doc/maintainer-scripts ]; the
8 n
9         rm -f /usr/doc/maintainer-scripts
10 fi
11
12 cat <<EOF
13 This is all really bad bash specific code!!!
14 read
15 source /bar/baz/bat foo
16 EOF
17
18 # ok, back to checking
19 if [ "$2" == "purge" ]; then
20         rm -r /bar/baz
21 fi
22
23 function foo( ) {
24    # but not here: local
25    local bar
26    echo "foo" &>/dev/null
27 }
28
29 source $FOO
30
31 trap "echo hi" EXIT HUP 3
32
33 if [[ "$2" = "purge" ]]; then
34     kill -HUP $$
35 fi
36
37 #this is ok though
38 if test -n $(echo foo | perl -pe 's/[[:space:]]//go'); then
39     echo 1
40 fi
41
42 update-rc.d foo remove
43
44 # More false positives for bashism checks.  None of these are errors.
45 echo "$line" | grep -q '{fonts/map,}/{\$progname,pdftex,dvips,}//'
46 echo "$line" | grep -q "${fonts},${foo}"
47 echo '$[1+2]'
48 printf "foo |& bar"
49 perl -e "print q( kill -HUP $? )"
50
51 # Still catch disallowed expansions in double-quotes, though.
52 echo "${line:3:1}"
53
54 # The wrong way to run an init script (no invoke-rc.d).
55 /etc/init.d/package stop
56
57 # This is the only install-sgmlcatalog call that's allowed.
58 install-sgmlcatalog --quiet --remove package
59
60 # More bashisms checks
61
62 read -x foo
63 read -x
64 read -r foo
65 read foo
66 read
67
68 echo "a\\b"
69 echo 'a\nb'
70
71 echo "${UID}"
72 echo "$EUID"
73 echo "$SHLVL"
74 echo "$DIRSTACK"
75 echo "$SECONDS"
76 echo "$BASH"
77 echo "$BASH_FOO"
78 echo "$SHELLOPTS"
79 echo "$PIPESTATUS"
80
81 bar="$(cut '-d|' -f2 <<< "$foo")"
82
83 VAR=1
84 VAR+=a
85
86 echos() {
87   echo -n -e "bar"
88   echo -e -n "bar"
89   echo -en "bar"
90   echo -ne "bar"
91   echo "bar"
92   echo "echo -e foo"
93 }
94
95 ech.os() {
96   echo foo >& 2
97   echo foo >&bar
98   echo foo >& bar
99 }
100
101 echoes() {
102   echo "abc\nxyz"
103   echo 'xyz\rabc'
104   echo foo\cbar
105
106   echo -e "abc\nxyz"
107   echo -net 'xyz\rabc'
108   echo -e foo\cbar
109 }
110
111 foobar.() {
112   suspend x
113   suspended x
114   caller x
115   complete x
116   compgen x
117   declare -a foo
118 }
119
120 .foobar() {
121   typeset -x bar
122   disown 1
123   builtin foo
124   set -B
125   alias -p
126   unalias -a
127 }
128
129 IFS="()"
130
131 ulimit
132 shopt
133 type -v bar
134 time ls
135 dirs
136 diff <(tac a) <(tac b)
137
138 pushd
139
140 local foo=bar
141 local -x foo
142
143 popd
144
145 readonly -f
146
147 echo bar > /dev/tcp
148 export x
149 export -x x
150 export -p x
151
152 sh -x
153 sh -D
154 sh --foo
155 sh +O
156
157 # Brace expansion checks
158 echo {a,b}
159 echo {abc},{bcd}
160
161 foobar()
162 {
163   # This is a function
164 }
165
166  foo.bar()
167 (
168   # This is a function with a bad name
169 )
170
171 foobar@()    
172 {
173   # As is this
174 }