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
Shell and echo replyramdas Shell Programming and Scripting 2 02-27-2008 03:40 AM
Echo with ksh shell Khoomfire UNIX for Advanced & Expert Users 10 01-17-2008 10:04 AM
b-shell: any better idea for this one?Thanks!! bluemoon1 Shell Programming and Scripting 2 09-08-2007 02:51 AM
Limitations of awk? Good idea? Bad idea? yongho Shell Programming and Scripting 2 06-08-2005 06:18 PM
angle brackets should be escaped automatically PxT Post Here to Contact Site Administrators and Moderators 4 08-10-2001 06:54 PM

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 05-04-2006
asami asami is offline
Registered User
  
 

Join Date: Mar 2006
Posts: 14
Echo escaped \c in SH Shell Any Idea

Hi All,

I have got an echo statement with "\c" in it to avoid getting into a newline. Ths script is using #!\bin\sh

Any idea what could make it to escape "\c"
  #2 (permalink)  
Old 05-04-2006
Klashxx's Avatar
Klashxx Klashxx is offline Forum Advisor  
HP-UX/Linux/Oracle
  
 

Join Date: Feb 2006
Location: Almerķa, Spain
Posts: 393
Perhaps you can use:
print -n

bye
  #3 (permalink)  
Old 05-04-2006
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,798
You are breaking the rules by bumping up posts. Moderators, please merge this thread with Which SHELL is this ?

You havent shown us what command you issued. Without that we cant help you.

Try reading the man pages as well. They have documented the use of \c very well.

See this.


Code:
[/tmp]$ cat try.sh
#! /bin/sh

echo -e "Line 1\c"
echo ""
echo -n "Line 2"
[/tmp]$ ./try.sh 
Line 1
Line 2[/tmp]$

From man sh


Code:
       echo [-neE] [arg ...]
              Output the args, separated by spaces,  followed  by  a  newline.
              The return status is always 0.  If -n is specified, the trailing
              newline is suppressed.  If the -e option is  given,  interpreta-
              tion  of  the following backslash-escaped characters is enabled.

  #4 (permalink)  
Old 05-04-2006
asami asami is offline
Registered User
  
 

Join Date: Mar 2006
Posts: 14
i am sorry, i just forget that i have mentioned this question in my other thread which actually started with another question

echo "adbcd \c"

echo -n "abcd"

Both are working for SH and BASH respectively, but at Production site i don't know what has happened wrong that is causing \c to escape.

Last edited by asami; 05-04-2006 at 08:26 AM.. Reason: moved the echo thing from other post to here
  #5 (permalink)  
Old 05-04-2006
asami asami is offline
Registered User
  
 

Join Date: Mar 2006
Posts: 14
Got Solution

Thanks Folks for your Patience (sorry for my quick posts)

echo is most inconsitent thing. There is a SYSV3 variable on Unix which tends to change the behaviour of echo command or shell-builtin.

Last edited by asami; 05-04-2006 at 08:57 AM.. Reason: Got Solution
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:26 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