The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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
setting width in echo statement s123.radha Shell Programming and Scripting 4 05-12-2008 08:02 AM
echo statement issue subin_bala Shell Programming and Scripting 3 04-24-2008 02:13 AM
Script does not execute Insert Statement Amruta Pitkar Shell Programming and Scripting 4 08-24-2006 11:14 PM
echo statement circleW Shell Programming and Scripting 3 10-03-2004 11:06 PM
awk command for INSERT statement nattynatty Shell Programming and Scripting 4 05-10-2002 02:11 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 08-25-2005
sunils27 sunils27 is offline
Registered User
  
 

Join Date: Aug 2005
Posts: 1
Insert TAB in echo statement

Hi,

Can some1 help me to output a tab in an echo statement.
I have tried
echo "RNC: \t NODEB"
but dont get the correct output.

I am a beginnger to unix, so pls hold back the laughs....if u can
  #2 (permalink)  
Old 08-25-2005
Unbeliever Unbeliever is offline
Registered User
  
 

Join Date: Jul 2005
Location: England
Posts: 183
using gnu's echo you need to ad the -e argument.

echo -e "RNC: \t NODEB"
  #3 (permalink)  
Old 08-25-2005
bakunin bakunin is offline Forum Staff  
Bughunter Extraordinaire
  
 

Join Date: May 2005
Location: In the leftmost byte of /dev/kmem
Posts: 1,628
as a beginner you won't perhaps know this (and, besides, this is most often ignored by even the most veteran UN*Xers): 'echo' should not be used. Use "print" instead:

print - "abc\tdef"

will do exactly what you want - regardless of what version of print you are using.

bakunin
  #4 (permalink)  
Old 08-25-2005
vertigo23's Avatar
vertigo23 vertigo23 is offline
Registered User
  
 

Join Date: Jul 2005
Location: SF, CA
Posts: 73
Er, no.

Quote:
Originally Posted by bakunin
Use "print" instead:
What Unix are you using? In GNU/Linux, "print" is an alias to "run-mailcap" which certainly does not do what you're saying it does. It doesn't exist at all in OpenBSD, which is the other Unix I've got access to at the moment.
  #5 (permalink)  
Old 08-25-2005
Ygor's Avatar
Ygor Ygor is offline Forum Staff  
Moderator
  
 

Join Date: Oct 2003
Location: -31.96,115.84
Posts: 1,407
Perhaps bakunin was thinking of printf which is built-in to ksh and bash and should also be available as an executable.
  #6 (permalink)  
Old 08-26-2005
bakunin bakunin is offline Forum Staff  
Bughunter Extraordinaire
  
 

Join Date: May 2005
Location: In the leftmost byte of /dev/kmem
Posts: 1,628
"print" is an internal ksh-command. AFAIK it is also an internal command in the bash.

I don't know about OpenBSD and I definitely don't know about Linux (honestly, IMHO Linux is to UNIX what Lego is to construction works), but as much as I know there are many flavours of Linux all with different sets of (mostly unsensible) aliases, therefore what you say may or may not be true for another of the seveteen dozens of major distribution. (Still, this disdain of mine may reflect only personal preferences and I don't intend to start a religious war (tm) here about Unix flavours or flavours of somewhat-Unix-like OSes.)

I'd like to take back my obviously inflammatory remark in the general form i offered it and state instead that what i said is only true for real OSes with real shells, which have an internal "print" command.

bakunin

PS: i use AIX, HP-UX, SunOS and (most enjoyable) VMS.
Sponsored Links
Closed Thread

Bookmarks

Tags
linux

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 07:06 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