Skip to content

Instantly share code, notes, and snippets.

@justanotherdot
Last active June 12, 2020 10:44
Show Gist options
  • Save justanotherdot/b551f2885efe3abcb528d27379ab4f1e to your computer and use it in GitHub Desktop.
Save justanotherdot/b551f2885efe3abcb528d27379ab4f1e to your computer and use it in GitHub Desktop.
#!/bin/sh -eu
announce() {
S="$1"
S_LEN="$(echo $S | wc -m)"
TERM_WIDTH="$(tput cols)"
TERM_WIDTH="$(( TERM_WIDTH - 6 ))"
printf "===%*s%*s===\n" $(( (TERM_WIDTH + S_LEN) / 2 )) "$S" $(( (TERM_WIDTH - S_LEN) / 2 )) ""
}
announce "Examples"
echo "+ one"
echo "+ two"
echo "- three"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment