Skip to content

Instantly share code, notes, and snippets.

@amitizle
Created September 27, 2015 22:00
Show Gist options
  • Save amitizle/29e32f677456083275e0 to your computer and use it in GitHub Desktop.
Save amitizle/29e32f677456083275e0 to your computer and use it in GitHub Desktop.
Print title in bash
#!/usr/bin/env bash
# Usage: print_title word1 word2 .. wordn
title=${*:1}
title_size=${#title}
output_line_size=$(echo "$title_size + 4" | bc -l)
eval printf '=%.0s' {1..$output_line_size}
printf "\n"
printf "= $title ="
printf "\n"
eval printf '=%.0s' {1..$output_line_size}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment