@@ -218,6 +218,9 @@ prop_checkBashisms124 = verify checkBashisms "#!/bin/dash\ntype -p test"
218
218
prop_checkBashisms125 = verifyNot checkBashisms " #!/bin/busybox sh\n type -p test"
219
219
prop_checkBashisms126 = verifyNot checkBashisms " #!/bin/busybox sh\n read -p foo -r bar"
220
220
prop_checkBashisms127 = verifyNot checkBashisms " #!/bin/busybox sh\n echo -ne foo"
221
+ prop_checkBashisms128 = verify checkBashisms " #!/bin/sh\n [ -k /tmp ]"
222
+ prop_checkBashisms129 = verifyNot checkBashisms " #!/bin/dash\n test -k /tmp"
223
+ prop_checkBashisms130 = verify checkBashisms " #!/bin/sh\n [ -o errexit ]"
221
224
checkBashisms = ForShell [Sh , Dash , BusyboxSh ] $ \ t -> do
222
225
params <- ask
223
226
kludge params t
@@ -252,6 +255,18 @@ checkBashisms = ForShell [Sh, Dash, BusyboxSh] $ \t -> do
252
255
bashism (T_SimpleCommand id _ [asStr -> Just " test" , lhs, asStr -> Just op, rhs])
253
256
| op `elem` [ " <" , " >" , " \\ <" , " \\ >" , " <=" , " >=" , " \\ <=" , " \\ >=" ] =
254
257
unless isDash $ warnMsg id 3012 $ " lexicographical " ++ op ++ " is"
258
+ bashism (TC_Unary id _ op _)
259
+ | op `elem` [ " -k" , " -G" , " -O" ] =
260
+ unless isDash $ warnMsg id 3013 $ op ++ " is"
261
+ bashism (T_SimpleCommand id _ [asStr -> Just " test" , asStr -> Just op, _])
262
+ | op `elem` [ " -k" , " -G" , " -O" ] =
263
+ unless isDash $ warnMsg id 3013 $ op ++ " is"
264
+ bashism (TC_Unary id _ op _)
265
+ | op `elem` [ " -N" , " -o" , " -R" ] =
266
+ warnMsg id 3013 $ op ++ " is"
267
+ bashism (T_SimpleCommand id _ [asStr -> Just " test" , asStr -> Just op, _])
268
+ | op `elem` [ " -N" , " -o" , " -R" ] =
269
+ warnMsg id 3013 $ op ++ " is"
255
270
bashism (TC_Binary id SingleBracket op _ _)
256
271
| op `elem` [ " -ot" , " -nt" , " -ef" ] =
257
272
unless isDash $ warnMsg id 3013 $ op ++ " is"
0 commit comments