Echo escaped \c in SH Shell Any Idea


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Echo escaped \c in SH Shell Any Idea
# 1  
Old 05-04-2006
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  
Old 05-04-2006
Perhaps you can use:
print -n

bye
# 3  
Old 05-04-2006
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  
Old 05-04-2006
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  
Old 05-04-2006
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
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Using read with escaped variables

Not sure if this is possible, but I'm trying to read in a variable that needs to have its escape backslashes intact. So the person who enters the actual value does not have to type any \ characters. Example: read list X1000\ filecab.txt echo "$list" In this case the \ needs to be... (3 Replies)
Discussion started by: newbie2010
3 Replies

2. Shell Programming and Scripting

Regex:search/replace but not for escaped character

Hi Input: - -- --- ---- aa-bb-cc aa--bb--cc aa---bb---cc aa----bb----cc Output: . - -. -- aa.bb.cc (7 Replies)
Discussion started by: chitech
7 Replies

3. UNIX for Dummies Questions & Answers

Display file with escaped color codes

Hi, I have a file containing color codes: Fri May 25 17:13:04 2012: Starting MTA: exim4^ Loading cpufreq kernel modules...^How can I display it colorized on a linux terminal? (4 Replies)
Discussion started by: ripat
4 Replies

4. Solaris

Reason why some commands need escaped-characters and other not

Hi, this is my first post and hope to make some contribution soon. I'm still learning the basics of UNIX and Linux and BASH. Thus my need to understand the subject at hand. I don't have a problem with technical detail, so hit me :) I have a script where two commands use the contents of a... (2 Replies)
Discussion started by: doublefrangelic
2 Replies

5. UNIX for Advanced & Expert Users

echo 1 > /proc/sys/vm/drop_caches a good idea?

Hi folks. I work with several production servers, and I have seen in some Kernel Cache using most of the memory. See this pic: http://i51.tinypic.com/301nb6c.jpg Do you think this is a smart choice? Remember these are productions servers and it is extremely necesary this does not... (6 Replies)
Discussion started by: erick_tuk
6 Replies

6. Shell Programming and Scripting

Idea for DB Password in Shell Scripts

I work in an environment where we have a Oracle DB Server on a AIX box. There are several batch scripts that load and execute on the database. The DBA wants to periodically change the password. Ideally I would like to have one common place to maintain the database as it is changed. I was thinking... (2 Replies)
Discussion started by: mode09
2 Replies

7. Shell Programming and Scripting

problems with sed and bash. Escaped characters ?

Hi, I'm writing a long script for bash (on RHEL 5.0) to execute many commands. So, my idea is to create a function to deal with error checking and logging (see ceckoutput() below). This works with all commands except for sed. I think it may be a problems with escaped characters. So I did the... (4 Replies)
Discussion started by: macL
4 Replies

8. Shell Programming and Scripting

b-shell: any better idea for this one?Thanks!!

I'm new to the script programming and I have this piece of code (repeatedly used) in my program: while : do ................ ans=`ckyorn -p "Do you want to continue?"` if || || || ; then break elif || ; then echo "Aborting..." exit... (2 Replies)
Discussion started by: bluemoon1
2 Replies

9. Shell Programming and Scripting

Limitations of awk? Good idea? Bad idea?

Keeping in mind that I'm relatively comfortable with programming in general but very new to unix and korn/bourne shell scripts.. I'm using awk on a CSV file, and then performing calculations and operations on specific fields within specific records. The CSV file I'm working with has about 600... (2 Replies)
Discussion started by: yongho
2 Replies

10. Post Here to Contact Site Administrators and Moderators

angle brackets should be escaped automatically

I think that HTML code within posts should be turned off -- the vB Code can provide all the features we need. Then, you should modify the program to automatically escape any angle brackets, so that < gets translated to < and > gets translated to > I see a lot of people garble their posts... (4 Replies)
Discussion started by: PxT
4 Replies
Login or Register to Ask a Question