Add T_SourceCommand to wrap source commands and sourced code

Fixes #1181
This commit is contained in:
Ng Zhi An 2018-05-22 22:43:26 -07:00
parent 77546fba2f
commit 884eff0c36
3 changed files with 11 additions and 5 deletions

View file

@ -283,7 +283,10 @@ checkBashisms = ForShell [Sh, Dash] $ \t -> do
("read", if isDash then ["r", "p"] else ["r"]),
("ulimit", ["f"])
]
bashism t@(T_SourceCommand id src _) =
let name = fromMaybe "" $ getCommandName src
in do
when (name == "source") $ warnMsg id "'source' in place of '.' is"
bashism _ = return ()
varChars="_0-9a-zA-Z"