toaruos/util/cpad.sh
2011-10-27 17:39:40 -05:00

14 lines
208 B
Bash

#!/bin/bash
function cpad {
word="$1"
while [ ${#word} -lt $2 ]; do
word="$word$3";
if [ ${#word} -lt $2 ]; then
word="$3$word"
fi;
done;
echo "$word";
}