Skip to content

Instantly share code, notes, and snippets.

@SnapperGee
Last active July 15, 2021 06:10
Show Gist options
  • Save SnapperGee/4591300ed71e9578b49c0253fa22c7b7 to your computer and use it in GitHub Desktop.
Save SnapperGee/4591300ed71e9578b49c0253fa22c7b7 to your computer and use it in GitHub Desktop.
Bash script that opens man page with x-man-page
#!/usr/bin/env bash
# Xman v0.2
# On macOS, opens x-man page in new window for scripts
# that have man pages. Otherwise attempt to open with
# default man command.
for argument in "$@"; do
# If man page exists open with x-man-page
if man "$argument" > /dev/null 2>&1 ; then
open x-man-page://"$argument"
# else attempt to open with default man page
else
man "$argument"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment