Skip to content

Instantly share code, notes, and snippets.

@naranyala
Last active August 8, 2023 03:13
Show Gist options
  • Save naranyala/b86c75e3310a74c22bcb4c196edec883 to your computer and use it in GitHub Desktop.
Save naranyala/b86c75e3310a74c22bcb4c196edec883 to your computer and use it in GitHub Desktop.
#!/bin/bash
# ENHANCED MAN (github.com/naranyala)
##########################
# combining: man and bat #
##########################
# Check if the command is provided as the first command-line argument
if [[ -n "$1" ]]; then
command="$1"
else
# Prompt the user for the command
read -p "Enter the command: " command
fi
# Validate if the command is provided
if [[ -z "$command" ]]; then
echo "Please provide a command."
exit 1
fi
# Execute the `man` command and pipe the output to `bat` for colorizing
man "$command" | bat --language=man
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment