Created
August 20, 2014 15:16
-
-
Save codeinthehole/5f97090b6e95f8f7a14a to your computer and use it in GitHub Desktop.
Bash function for print pretty titles
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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