The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Use of tput ? dhananjaysk Shell Programming and Scripting 3 03-16-2006 09:52 AM
tput clear whatisthis Shell Programming and Scripting 4 10-07-2004 11:44 AM
quick question! TPUT!? moxxx68 UNIX for Dummies Questions & Answers 3 09-05-2004 12:56 AM
Bold the paragraph caprikar Shell Programming and Scripting 3 12-22-2003 06:44 PM
problem with incorporating tput in a c program TRUEST High Level Programming 3 01-26-2003 11:04 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-07-2006
pondlife pondlife is offline
Registered User
  
 

Join Date: May 2004
Location: UK
Posts: 85
tput smso (bold) ruins formatting

Hi,

I have some very nicely formatted output on a monitor script and I'd like to make one of the fields bold when a threshold is reached but when I do it changes the formatting.

I've tried using tabs to separate the fields and I've tried using printf to force the size of the fields. Below is the printf version:

Quote:
printf "%-31s %-21s:\n" "PAC Fail 24H=$percent% 1H=$percent_1_hour%" "| LOCKED = $OUTLOCKEDCOUNT"
Whenever either of the variables are bold (using tput) the formatting goes - it's as though the forced width of 31 is ignored.

Is there another way to format my output? Is my printf statement wrong?

Many thanks,

pondlife.
  #2 (permalink)  
Old 02-07-2006
linuxpenguin's Avatar
linuxpenguin linuxpenguin is offline Forum Advisor  
Registered User
  
 

Join Date: May 2002
Location: India
Posts: 295
what is the shell you are using
normally I set variables for fonts
eg BOLD=`echo \033[1m`
NORMAL=`echo \033[0m`

and so on
and any text that needs this formatting is preceded with the $BOLD and ends with $NORMAL.
this works for k shell.

in your shell, you could use this

BOLD=`tput smso bold`

and then echo ${BOLD} Your text

Last edited by linuxpenguin; 02-07-2006 at 01:40 PM.. Reason: added
  #3 (permalink)  
Old 02-07-2006
pondlife pondlife is offline
Registered User
  
 

Join Date: May 2004
Location: UK
Posts: 85
Hi linuxpenquin,

Thanks for the reply. I'm using ksh (on Solaris)- I tried the escape character bold/normal you posted but it doesn't seem to work in my shell.

Thanks,

pondlife.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:40 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0