aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDuncaen <mail@duncano.de>2017-02-13 02:40:28 +0100
committerDuncaen <mail@duncano.de>2017-02-13 02:41:24 +0100
commit4f764ea856073b363639d1a9f417d87868e2c5a4 (patch)
tree763de4bd8e26f3ff9b77946d9bd9a9b70af7065c
parentece5465cc049382efdc4743ec687cad2bf994ded (diff)
downloaddotfiles-4f764ea856073b363639d1a9f417d87868e2c5a4.tar.gz
bin: add twoman
-rwxr-xr-xbin/twoman17
1 files changed, 17 insertions, 0 deletions
diff --git a/bin/twoman b/bin/twoman
new file mode 100755
index 0000000..6e5abd4
--- /dev/null
+++ b/bin/twoman
@@ -0,0 +1,17 @@
+#!/bin/sh
+# twoman CMD... - show comment at line >2
+for x; do
+ path=$(command -v "$x" 2>/dev/null)
+ [ -z "$path" ] && continue
+ magic="$(dd if="$path" bs=2 count=1 2>/dev/null | od -An)"
+ magic=$(printf '%d' "$magic")
+ case "$magic" in 8483) ;; *) continue;; esac
+ awk '
+BEGIN {x=1}
+END {print "--"}
+NR>=2 && x {
+ x=sub("^#[ ]?","")
+ if(x){print}
+}
+' "$path"
+done