![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| echo statement issue | subin_bala | Shell Programming and Scripting | 3 | 04-23-2008 11:13 PM |
| If statement - How to write a null statement | april | Shell Programming and Scripting | 3 | 04-16-2008 10:14 AM |
| Insert TAB in echo statement | sunils27 | Shell Programming and Scripting | 5 | 08-26-2005 12:36 AM |
| Perl equivalent of ksh if / echo statement | gefa | Shell Programming and Scripting | 2 | 02-17-2005 09:07 AM |
| echo statement | circleW | Shell Programming and Scripting | 3 | 10-03-2004 08:06 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Display Modes |
|
#1
|
|||
|
|||
|
setting width in echo statement
Hello All,
I need to set the width or number of columns for my dynamic output in the echo statement. statement is like: echo " <output> [PASS]" here the <output> is dyamice and can be of any number of characters, the " [PASS]" should always start in same column everytime it is exected. |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Use printf instead of echo. Search on the net for printf examples.
Regards |
|
#3
|
|||
|
|||
|
I am using this echo statement in perl ... i want my output in color... i think i cant make the output on screen in color with " printf" statement.. please tell me if it is possible for printf to give colored output..
|
|
#4
|
||||
|
||||
|
Hi.
This worked in a Linux Konsole and an xterm to set the color: Code:
#!/usr/bin/perl
# @(#) p0 Demonstrate color in perl.
# use warnings;
# use strict;
$rgb_restore = "\e[00m";
$rgb_black = "\e[00;30m";
$rgb_red = "\e[01;31m";
$rgb_green = "\e[01;32m";
print "\nWith print:\n";
print " The word $rgb_red red $rgb_restore is red.\n";
print " The word $rgb_green green $rgb_restore is green.\n";
print "\nWith printf:\n";
printf(" The word $rgb_red red $rgb_restore is red.\n");
printf(" The word $rgb_green green $rgb_restore is green.\n");
print "\n";
print "$rgb_restore (Restoring)\n";
print "$rgb_black (Black)\n";
exit(0);
|
|
#5
|
|||
|
|||
|
Thanks drl...
I got it [ |
|||
| Google The UNIX and Linux Forums |
| Thread Tools | |
| Display Modes | |
|
|