From e816a052f7a79dd988e158ab147099435da64059 Mon Sep 17 00:00:00 2001 From: Tom Ryder Date: Thu, 4 Jun 2015 16:23:21 +1200 Subject: Workaround to give han(1) help pages better names --- bin/han | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'bin/han') diff --git a/bin/han b/bin/han index d8d1e8dd..0d2f6755 100755 --- a/bin/han +++ b/bin/han @@ -21,6 +21,7 @@ # Author: Tom Ryder # Copyright: 2015 Inspire Net Ltd # +self=han # Give up completely if no BASH_VERSINFO (<2.0) if ! test "$BASH_VERSINFO" ; then @@ -35,16 +36,17 @@ if ((BASH_VERSINFO[0] >= 4)) ; then fi # Create a temporary file and set up a trap to get rid of it. -out=$(mktemp) +tmpdir=$(mktemp -dt "$self".XXXXX) || exit cleanup() { - rm -f -- "$out" + rm -fr -- "$tmpdir" } trap cleanup EXIT # If we have exactly one argument and a call to the help builtin with that # argument succeeds, display its output with `pager -s`. -if (($# == 1)) && help "${helpopts[@]}" "$1" >"$out" 2>/dev/null ; then - pager -s -- "$out" +if (($# == 1)) && \ + help "${helpopts[@]}" "$1" >"$tmpdir"/"$1".help 2>/dev/null ; then + (cd -- "$tmpdir" && pager -s -- "$1".help) # Otherwise, just pass all the arguments to man(1). else -- cgit v1.2.3