dotfiles

configuration files
git clone https://pi.duncano.de/git/dotfiles.git
Log | Files | Refs | README

commit feb24aac3fee8cf89030ed4ad4ea09933a931536
parent 6744c75461d96634c483278766ff50a53c5226f7
Author: Duncaen <mail@duncano.de>
Date:   Thu, 16 Feb 2017 01:21:45 +0100

bin/twoman: simplify and use sed program from leah2

Diffstat:
bin/twoman | 20+++++---------------
1 file changed, 5 insertions(+), 15 deletions(-)

diff --git a/bin/twoman b/bin/twoman @@ -1,17 +1,7 @@ #!/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" +# twoman CMD... - show comments at the beginning of a script +for cmd; do + cmd=$(command -v "$cmd" 2>/dev/null) + [ -z "$cmd" ] && continue + sed -n '1{/^[^#][^!]/q;d};0,/^$\|^[^#]/s/^# //p' $cmd done