[SLUG] pad a variable with spaces in bash?

From: Eben King (eben1@tampabay.rr.com)
Date: Sat Feb 14 2004 - 21:06:30 EST


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"')?

-- 
-eben    ebQenW1@EtaRmpTabYayU.rIr.OcoPm    home.tampabay.rr.com/hactar
   Your pretended fear lest error might step in is like the man who
   would keep all wine out of the country lest men should be drunk.
                                                 -- Oliver Cromwell

----------------------------------------------------------------------- This list is provided as an unmoderated internet service by Networked Knowledge Systems (NKS). Views and opinions expressed in messages posted are those of the author and do not necessarily reflect the official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 17:52:44 EDT