commit 30c9a7cccd564ff094ef5801da13d06f9ba64049
parent f647e429af44253a46bde36c2ab7768ae3f27161
Author: Jacob R. Edwards <jacobouno@protonmail.com>
Date: Sun, 14 Feb 2021 13:22:43 -0800
Improve efficiency and accuracy of sman.sed script
Combine shebang elimination and the insertion of a blank line by
assuming that the first line is a shebang, this is more efficient
for obvious reasons and more accurate because you may place `#!'
anywhere. It does assume that the first line of your script is a
shebang though.
Diffstat:
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/modules/scripts/.local/bin/sman.sed b/modules/scripts/.local/bin/sman.sed
@@ -7,10 +7,11 @@
# Display the first comment (`#') block of a file, excluding the
# shebang, within blank lines and indented by two spaces.
-1i\
+1 { i\
-/^#!/d
-/^#/! { i\
+ d
+}
+/^#/ !{ i\
q
}