Created
May 7, 2019 13:15
-
-
Save cameroncros/a4dfb97c6dc9591ea98dc9e6b7201f4a to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
right_adjust () { | |
WIDTH=$(tput cols) | |
CHARS=$(echo $1 | wc -c) | |
PADDING=$(($WIDTH-$CHARS)) | |
SPACES="" | |
val=$(printf "%*s%s\n" $PADDING " " "$1") | |
echo "$val" | |
} | |
right_adjust "Strings" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment