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.

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 05-26-2007
unitipon unitipon is offline
Registered User
  
 

Join Date: May 2007
Posts: 42
why

Why it prints out like this

root$ echo '\n\t'"No disk capacity more than 80%" '\n'
\n\tNo disk capacity more than 80% \n #result

I don't know what happen, if u know please tell me why and how to solve it
  #2 (permalink)  
Old 05-26-2007
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,100
The problem is that you are using a poor shell. Fix the problem by switching to a better shell.

Code:
$ ksh
$ echo '\n\t'"No disk capacity more than 80%" '\n'

        No disk capacity more than 80%

$ csh
%echo '\n\t'"No disk capacity more than 80%" '\n'
\n\tNo disk capacity more than 80% \n
%
See? It works when I use ksh and it fails with csh.
  #3 (permalink)  
Old 05-26-2007
drl's Avatar
drl drl is offline Forum Advisor  
Registered User
  
 

Join Date: Apr 2007
Location: Saint Paul, MN USA / BSD, CentOS, Debian, OS X, Solaris
Posts: 699
Hi.

I would discourage the use of (t)csh for scripting, but if you must use it, you could try using the non-built-in echo:
Code:
#!/bin/csh

# @(#) s1       Demonstrate stand-alone echo.

echo
echo $version | fmt
echo

echo -e '\n\t' "No disk capacity more than 80%" '\n'

/bin/echo -e '\n\t' "No disk capacity more than 80%" '\n'

exit 0
which produces:
Code:
% ./s1

tcsh 6.13.00 (Astron) 2004-05-19 (i386-intel-linux) options
8b,nls,bye,al,ng,rh,nd,color,filec

-e \n\t No disk capacity more than 80% \n

         No disk capacity more than 80%
and also:
Quote:
echo [-n] word ...
Writes each word to the shell's standard output, separated by
spaces and terminated with a newline. The echo_style shell
variable may be set to emulate (or not) the flags and escape
sequences of the BSD and/or System V versions of echo; see
echo(1).

-- excerpt form man tcsh
cheers, drl
  #4 (permalink)  
Old 05-27-2007
unitipon unitipon is offline
Registered User
  
 

Join Date: May 2007
Posts: 42
Thumbs up

Thank u for your help !!!
Sponsored Links
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 04:52 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
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