Sponsored Content
Top Forums Shell Programming and Scripting Echo escaped \c in SH Shell Any Idea Post 302072582 by vino on Thursday 4th of May 2006 07:14:34 AM
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.

 

10 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

5. 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

6. 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

7. 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

8. 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

9. 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

10. 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
ECHO(1) 						    BSD General Commands Manual 						   ECHO(1)

NAME
echo -- write arguments to the standard output SYNOPSIS
echo [-n] [string ...] DESCRIPTION
The echo utility writes any specified operands, separated by single blank (' ') characters and followed by a newline (' ') character, to the standard output. The following option is available: -n Do not print the trailing newline character. The end-of-options marker -- is not recognized and written literally. The newline may also be suppressed by appending 'c' to the end of the string, as is done by iBCS2 compatible systems. Note that the -n option as well as the effect of 'c' are implementation-defined in IEEE Std 1003.1-2001 (``POSIX.1'') as amended by Cor. 1-2002. For porta- bility, echo should only be used if the first argument does not start with a hyphen ('-') and does not contain any backslashes (''). If this is not sufficient, printf(1) should be used. Most shells provide a builtin echo command which tends to differ from this utility in the treatment of options and backslashes. Consult the builtin(1) manual page. EXIT STATUS
The echo utility exits 0 on success, and >0 if an error occurs. SEE ALSO
builtin(1), csh(1), printf(1), sh(1) STANDARDS
The echo utility conforms to IEEE Std 1003.1-2001 (``POSIX.1'') as amended by Cor. 1-2002. BSD
November 12, 2010 BSD
All times are GMT -4. The time now is 09:03 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy