echo(1) General Commands Manual echo(1)Name
echo - echo arguments
Syntax
echo [-n] [arg...]
Description
The command writes its arguments separated by blanks and terminated by a new line on the standard output.
Options-n Suppresses newlines from output.
Examples
The command is useful for producing diagnostics in shell programs and for writing constant data on pipes.
To send diagnostics to the standard error file, type the following:
echo ... 1>&2
echo(1)
Check Out this Related Man Page
echo(1B) SunOS/BSD Compatibility Package Commands echo(1B)NAME
echo - echo arguments to standard output
SYNOPSIS
/usr/ucb/echo [-n] [argument]
DESCRIPTION
echo writes its arguments, separated by BLANKs and terminated by a NEWLINE, to the standard output.
echo is useful for producing diagnostics in command files and for sending known data into a pipe, and for displaying the contents of envi-
ronment variables.
For example, you can use echo to determine how many subdirectories below the root directory (/) is your current directory, as follows:
o echo your current-working-directory's full pathname
o pipe the output through tr to translate the path's embedded slash-characters into space-characters
o pipe that output through wc -w for a count of the names in your path.
example% /usr/bin/echo "echo $PWD | tr '/' ' ' | wc -w"
See tr(1) and wc(1) for their functionality.
The shells csh(1), ksh(1), and sh(1), each have an echo built-in command, which, by default, will have precedence, and will be invoked if
the user calls echo without a full pathname. /usr/ucb/echo and csh's echo() have an -n option, but do not understand back-slashed escape
characters. sh's echo(), ksh's echo(), and /usr/bin/echo, on the other hand, understand the black-slashed escape characters, and ksh's
echo() also understands a as the audible bell character; however, these commands do not have an -n option.
OPTIONS -n Do not add the NEWLINE to the output.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Availability |SUNWscpu |
+-----------------------------+-----------------------------+
SEE ALSO csh(1), echo(1), ksh(1), sh(1), tr(1), wc(1), attributes(5)NOTES
The -n option is a transition aid for BSD applications, and may not be supported in future releases.
SunOS 5.11 3 Aug 1994 echo(1B)
I am having a problem with the following statement in a korn shell script:
if "$all_recs" = "ALL"; then
commands
fi;
I keep getting the error syntax error at line 999 : 'then' unmatched.
I'm sure it is a minor problem, but have been unable to find any answers online. Any help... (22 Replies)
does anyone know how to combine 2 lines? this is what im playing around with.
(filename: online, user name: prml0001, real name: primal)
#!/bin/sh
who | grep $1 > /dev/null
if
then
grep $1 /etc/passwd | cut -f 5, -d :
echo is logged on
exit 0
else
grep $1... (13 Replies)
Does anybody know what is wrong here. I am running centOS
the anticrash gives me this.
#!/bin/sh
while true
do
rm banme.tmp
:> banme.txt
/usr/sbin/tcpdump -p -c 100 -n -i eth0 "dst host 66.197.12 6.19 and udp port 7777" >banme.tmp
grep "length 0" banme.tmp | cut -f 3 -d " " |... (14 Replies)
Hi there,
I'd like to find a way to display a string and count the words in it.
supernova:~# echo 'hello world' | tee - | wc
Unfortunately, this doesn't work.
Any idea?
Thanks in advance.
Santiago (15 Replies)
Hi All,
Need help in resoving the issue . Can anyone let me know how to get fix length using unix shellscript.
For Ex: echo "NUMBER OF RECORDS "${NO_OF_ROWS}"\nFILE CREATION DATE&TIME "${PROD_DT}"
output should be :
NUMBER OF RECORDS 2546
CREATIN DATE&TIME 2009-12-01
Each... (14 Replies)
Hi,when I run my first shell script,I got something that doesn't work right.
I wrote this code in the script.
echo -e "Hello,World\a\n"But the screen print like this:
-e Hello,World
The "-e" wasn't supposed to be printed out.
Can anyone help me out?:wall:
Many thanks!:) (25 Replies)
Sorry folks, Second time today.
I am working on a script that accepts data via pipe and processes it.
I expect it to work as:
# command | ProcScript.sh
Within ProcScript.sh, I want to be able to give the target of the prev run command
I am using history 2 | grep -v history | awk... (18 Replies)
Hello,
'echo' command is not printing the exacting content as I needed.
I'm trying below, which is not echoing the correct content.
echo "XYZ\\`hostname`-volume" >> 123
# cat 123
XYZ
Where, It suppose to get
# cat 123
XYZ\hostname-volume
Please let me know how to resolve.
... (20 Replies)
Hello all!
I am on Mac (10.8.4) and my shell tcsh (man says version: Astron 6.17.00). Just to precise my tcsh:
echo $LC_CTYPE
UTF-8
I want to replace all ':' with a new line, to get all paths on one line. I don't find a way to make my shell accept the "\n"
My start was:
echo... (17 Replies)
I have a script that runs from this:
for i in * ; do (cd $i && echo $i && /test1/execute/testb);done
this is testb:
for file in `ls *.txt`
do
if && && && &&
&& ; then echo "NO"; break 1;
else
echo "it is there"
fi
done
What is happening is that I can get it to run a... (19 Replies)
Hi guys...
Sometime ago I said I was going to attempt an Android project.
I got my phone for XMAS and after installing a terminal program I realised how limited the command line is.
I do NOT intend to __root__ the phone at this point but I can read and write to certain folders.
The biggest... (14 Replies)
Hello,
I've been trying to find the answer to this with Google and trying to browse the forums, but I haven't been able to come up with anything. If this has already been answered, please link me to the thread as I can't find it.
I've been asked to write a script that pulls a list of our CPE... (51 Replies)
Hello
i have a file with this format:
ip.txt content:
192.168.1.1/2020
192.136.1.2/2028
192.168.1.10/3047
....
need to create 1000 files and each files content, import data from ip.txt line (first file with first line data, second file with second line...etc)
internal=yes
internalip=... (14 Replies)