Skip to content

Instantly share code, notes, and snippets.

@codeinthehole
Created August 20, 2014 15:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codeinthehole/5f97090b6e95f8f7a14a to your computer and use it in GitHub Desktop.
Save codeinthehole/5f97090b6e95f8f7a14a to your computer and use it in GitHub Desktop.
Bash function for print pretty titles
#!/usr/bin/env bash
# Pretty printing function for Bash output
#
# Example usage:
#
# $ notify "hello world"
#
# +-------------+
# | hello world |
# +-------------+
#
# $
function notify() {
local len=$((${#1}+2))
printf "\n+"
printf -- "-%.0s" $(seq 1 $len)
printf "+\n| $1 |\n+"
printf -- "-%.0s" $(seq 1 $len)
printf "+\n\n"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment