diff --git a/sh/core/code.awk b/sh/core/code.awk index b7da4ef..76a8e24 100644 --- a/sh/core/code.awk +++ b/sh/core/code.awk @@ -28,6 +28,9 @@ function extract(string, type) { } else if (type == "module") { split(string, array, "#\\.") return trim(array[2]) + } else if (type == "shebang") { + split(string, array, "#!") + return trim(array[2]) } else if ((type == "constant") || (type == "variable")) { split(string, array, "=") return trim(array[1]) @@ -152,8 +155,8 @@ BEGIN { } } else if (action == "doc") { # doc - if (match($0, RE_SHEBANG, m)) { - append("! " m[1]) + if (match($0, RE_SHEBANG)) { + append("! " extract($0, "shebang")) } else if (match($0, RE_DOC, m)) { if (f) { append($0)