diff --git a/after.sh b/after.sh index 02fc13a..2d1db22 100644 --- a/after.sh +++ b/after.sh @@ -112,7 +112,20 @@ setopt HIST_IGNORE_SPACE # Manual to pdf # ───────────────────────────────────── -manual() { man -Tpdf "$1" | okular -; } +manual() { + local pdf + pdf=$(mktemp --suffix=.pdf) || return 1 + + if ! man -Tpdf "$1" > "$pdf" 2>/dev/null; then + rm -f "$pdf" + echo "No manual entry for $1" + return 1 + fi + + okular "$pdf" + rm -f "$pdf" +} + EOF # Make everything we created belong to the user