mirror of
https://github.com/koalaman/shellcheck
synced 2025-07-15 01:23:07 -07:00
Don't suggest grep -c when used with -o
This commit is contained in:
parent
b0dae063bf
commit
1a8e34bfea
2 changed files with 18 additions and 7 deletions
|
@ -211,14 +211,19 @@ braceExpand (T_NormalWord id list) = take 1000 $ do
|
|||
braceExpand item
|
||||
part x = return x
|
||||
|
||||
-- Maybe get the command name of a token representing a command
|
||||
getCommandName t =
|
||||
-- Maybe get a SimpleCommand from immediate wrappers like T_Redirections
|
||||
getCommand t =
|
||||
case t of
|
||||
T_Redirecting _ _ w -> getCommandName w
|
||||
T_SimpleCommand _ _ (w:_) -> getLiteralString w
|
||||
T_Annotation _ _ t -> getCommandName t
|
||||
T_Redirecting _ _ w -> getCommand w
|
||||
T_SimpleCommand _ _ (w:_) -> return t
|
||||
T_Annotation _ _ t -> getCommand t
|
||||
otherwise -> Nothing
|
||||
|
||||
-- Maybe get the command name of a token representing a command
|
||||
getCommandName t = do
|
||||
(T_SimpleCommand _ _ (w:_)) <- getCommand t
|
||||
getLiteralString w
|
||||
|
||||
-- If a command substitution is a single command, get its name.
|
||||
-- $(date +%s) = Just "date"
|
||||
getCommandNameFromExpansion :: Token -> Maybe String
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue