Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!crdgw1!uunet!virtech!cpcahil From: cpcahil@virtech.uucp (Conor P. Cahill) Newsgroups: comp.unix.shell Subject: Re: adjusting string var to fixed length Message-ID: <1991Jun03.232947.13848@virtech.uucp> Date: 3 Jun 91 23:29:47 GMT References: <1991Jun3.181447.12656@mnemosyne.cs.du.edu> Organization: Virtual Technologies Inc. Lines: 19 rchattam@isis.cs.du.edu (King Chattam) writes: > Could someone please tell me how blanks can be appended to string vars >to make it fixed length? The following will do what you want: a=abc t="`expr \"$a \" : \"\(..........\)\"`" echo "x${t}x" You will get: "xabc x" which is $a plus 7 blanks. The x's are only used to mark the string so you can see that the blanks actually are there. -- Conor P. Cahill (703)430-9247 Virtual Technologies, Inc. uunet!virtech!cpcahil 46030 Manekin Plaza, Suite 160 Sterling, VA 22170