Eben King wrote:
>Does anybody know how to pad a variable with spaces in bash? In {pd}ksh,
>
>.--
>| #! /bin/ksh
>| typeset -L8 foo=bar
>| echo "a${foo}b"
>'--
>
>would print
>abar b
>
>How would I do a similar thing in bash (without calling ksh -c 'typeset
>-L8 foo=bar; echo "a${foo}b"')?
>
>
>
I don't know of a built-in, but there's always /usr/bin/printf from the
GNU coreutils.
foo=bar
printf "a%-8sb\n" $foo
Mike
This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 20:08:53 EDT