|
|
|
|
google site
|
|||||||
| Forums | Register | Blog | Man Pages | Forum Rules | Links | Albums | FAQ | Users | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
![]() |
|
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|||
|
Help with typeset in bash
Hi everybody, hoping you can help.
I'm trying to get some scripts working using bash which were written in ksh and I'm struggling with typeset. Specifically typeset -R and typeset -L. We need fixed length variables with left and right justification and bash does not seem to do it. Spent ages on Google and just seem to be getting nowhere Thansk in advance |
| Sponsored Links | ||
|
|
|
|||
|
|
|
|||
|
If I could use ksh there would be little point me trying to convert them to bash unfortunately sysadmins being what they are bash is all I've got. I've managed to use "tr" to get round typeset -l and -u but I'm still stuck with -L and -R to left and right justify variables and give them a fixed length, printf is no use because I'm, not printing these variables, they are needed later on in the script.
Thanks again |
|
||||
|
Quote:
If you have bash3, you can use the much faster: Code:
printf -v var1 "%5s" "$value" ## Flush right printf -v var2 "%-5s" "$value" ## Flush left |
| Sponsored Links |
|
|
![]() |
| Bookmarks |
| Tags |
| linux, linux commands |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Typeset | bisla.yogender | Shell Programming and Scripting | 3 | 04-30-2008 07:45 AM |
| typeset in Ksh | nervous | UNIX for Dummies Questions & Answers | 5 | 10-19-2006 03:48 PM |
| typeset -f ??? | xinfinity | Shell Programming and Scripting | 1 | 04-04-2006 05:43 PM |
| TYPESET use | sam71 | UNIX for Dummies Questions & Answers | 4 | 05-02-2005 01:16 PM |