function padding { typeset text n c pos eval "$@" while (( ${#text} < n )); do if [[ $pos = "append" ]] then text="$text$c" else text="$c$text" fi done printf "%s\n" $text }