mirror of
https://github.com/koalaman/shellcheck.git
synced 2025-08-08 16:26:26 +08:00
Use head instead of reimplementing it
Normally I wouldn't use head, but this code is partial anyway.
This commit is contained in:
@@ -565,9 +565,7 @@ checkShebang params (T_Script _ (T_Literal id sb) _) = execWriter $ do
|
||||
unless (null sb) $ do
|
||||
unless ("/" `isPrefixOf` sb) $
|
||||
err id 2239 "Ensure the shebang uses an absolute path to the interpreter."
|
||||
case words sb of
|
||||
first:_ ->
|
||||
when ("/" `isSuffixOf` first) $
|
||||
when ("/" `isSuffixOf` head (words sb)) $
|
||||
err id 2246 "This shebang specifies a directory. Ensure the interpreter is a file."
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user