Added check for grep foo*
This commit is contained in:
parent
96c8a01017
commit
e8a2ac09c7
|
@ -68,6 +68,7 @@ basicChecks = [
|
|||
,checkAssignAteCommand
|
||||
,checkUuoe
|
||||
,checkFindNameGlob
|
||||
,checkGrepRe
|
||||
]
|
||||
|
||||
modifyMap = modify
|
||||
|
@ -519,6 +520,21 @@ checkFindNameGlob = checkCommand "find" f where
|
|||
f (b:r)
|
||||
|
||||
|
||||
prop_checkGrepRe1 = verify checkGrepRe "cat foo | grep *.mp3"
|
||||
prop_checkGrepRe2 = verify checkGrepRe "grep -Ev cow*test *.mp3"
|
||||
prop_checkGrepRe3 = verify checkGrepRe "grep --regex=*.mp3 file"
|
||||
prop_checkGrepRe4 = verifyNot checkGrepRe "grep foo *.mp3"
|
||||
prop_checkGrepRe5 = verifyNot checkGrepRe "grep-v --regex=moo *"
|
||||
checkGrepRe = checkCommand "grep" f where
|
||||
-- --regex=*(extglob) doesn't work. Fixme?
|
||||
skippable (Just s) = not ("--regex=" `isPrefixOf` s) && "-" `isPrefixOf` s
|
||||
skippable _ = False
|
||||
f [] = return ()
|
||||
f (x:r) | skippable (getLiteralString x) = f r
|
||||
f (re:_) = do
|
||||
when (isGlob re) $ do
|
||||
warn (getId re) $ "Quote the grep pattern so the shell won't interpret it."
|
||||
|
||||
|
||||
--- Subshell detection
|
||||
|
||||
|
|
Loading…
Reference in New Issue