|
Hopefully, this page is exactly what you are looking for, but if not, you can always find further assistance on Unix/Linux Forum!
User Commands echo(1)
NAME
echo - echo arguments
SYNOPSIS
/usr/bin/echo [string...]
DESCRIPTION
The echo utility writes its arguments, separated by BLANKs
and terminated by a NEWLINE, to the standard output. If
there are no arguments, only the NEWLINE character is writ-
ten.
echo is useful for producing diagnostics in command files,
for sending known data into a pipe, and for displaying the
contents of environment variables.
The C shell, the Korn shell, and the Bourne shell all have
echo built-in commands, which, by default, is invoked if the
user calls echo without a full pathname. See
shell_builtins(1). sh's echo, ksh's echo, and /usr/bin/echo
understand the back-slashed escape characters, except that
sh's echo does not understand \a as the alert character. In
addition, ksh's echo does not have an -n option. sh's echo
and /usr/bin/echo have an -n option if the SYSV3 environment
variable is set (see ENVIRONMENT VARIABLES below). csh's
echo and /usr/ucb/echo, on the other hand, have an -n
option, but do not understand the back-slashed escape char-
acters. sh and ksh determine whether /usr/ucb/echo is found
first in the PATH and, if so, they adapt the behavior of the
echo builtin to match /usr/ucb/echo.
OPERANDS
The following operand is supported:
string A string to be written to standard output. If any
operand is "-n", it is treated as a string, not an
option. The following character sequences is recog-
nized within any of the arguments:
\a Alert character.
\b Backspace.
\c Print line without new-line. All charac-
ters following the \c in the argument are
ignored.
SunOS 5.10 Last change: 17 Jul 2006 1
User Commands echo(1)
\f Form-feed.
\n New-line.
\r Carriage return.
\t Tab.
\v Vertical tab.
\\ Backslash.
\0n Where n is the 8-bit character whose ASCII
code is the 1-, 2- or 3-digit octal number
representing that character.
USAGE
Portable applications should not use -n (as the first argu-
ment) or escape sequences.
The printf(1) utility can be used portably to emulate any of
the traditional behaviors of the echo utility as follows:
o The Solaris 2.6 operating environment or compatible
version's /usr/bin/echo is equivalent to:
printf "%b\n" "$*"
o The /usr/ucb/echo is equivalent to:
if [ "X$1" = "X-n" ]
then
shift
SunOS 5.10 Last change: 17 Jul 2006 2
User Commands echo(1)
printf "%s" "$*"
else
printf "%s\n" "$*"
fi
New applications are encouraged to use printf instead of
echo.
EXAMPLES
Example 1: Finding how far below root your current directory
is located
You can use echo to determine how many subdirectories below
the root directory (/) is your current directory, as fol-
lows:
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 $PWD | tr '/' ' ' | wc -w
See tr(1) and wc(1) for their functionality.
Below are the different flavors for echoing a string without
a NEWLINE:
Example 2: /usr/bin/echo
example% /usr/bin/echo "$USER's current directory is $PWD\c"
Example 3: sh/ksh shells
example$ echo "$USER's current directory is $PWD\c"
Example 4: csh shell
example% echo -n "$USER's current directory is $PWD"
Example 5: /usr/ucb/echo
SunOS 5.10 Last change: 17 Jul 2006 3
User Commands echo(1)
example% /usr/ucb/echo -n "$USER's current directory is $PWD"
ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment
variables that affect the execution of echo: LANG, LC_ALL,
LC_CTYPE, LC_MESSAGES, and NLSPATH.
SYSV3 This environment variable is used to provide compa-
tibility with INTERACTIVE UNIX System and SCO UNIX
installation scripts. It is intended for compati-
bility only and should not be used in new scripts.
This variable is applicable only for Solaris x86
platforms, not Solaris SPARC systems.
EXIT STATUS
The following error values are returned:
0 Successful completion.
>0 An error occurred.
ATTRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
____________________________________________________________
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
|_____________________________|_____________________________|
| Availability | SUNWcsu |
|_____________________________|_____________________________|
| CSI | Enabled |
|_____________________________|_____________________________|
| Interface Stability | Standard |
|_____________________________|_____________________________|
SEE ALSO
echo(1B), printf(1), shell_builtins(1), tr(1), wc(1),
ascii(5), attributes(5), environ(5), standards(5)
NOTES
When representing an 8-bit character by using the escape
convention \0n, the n must always be preceded by the digit
zero (0).
SunOS 5.10 Last change: 17 Jul 2006 4
User Commands echo(1)
For example, typing: echo 'WARNING:\07' prints the phrase
WARNING: and sounds the "bell" on your terminal. The use of
single (or double) quotes (or two backslashes) is required
to protect the "\" that precedes the "07".
Following the \0, up to three digits are used in construct-
ing the octal output character. If, following the \0n, you
want to echo additional digits that are not part of the
octal representation, you must use the full 3-digit n. For
example, if you want to echo "ESC 7" you must use the three
digits "033" rather than just the two digits "33" after the
\0.
2 digits Incorrect: echo "\0337" | od -xc
produces: df0a (hex)
337 (ascii)
3 digits Correct: echo "\00337" | od -xc
produces: lb37 0a00 (hex)
033 7 (ascii)
For the octal equivalents of each character, see ascii(5).
SunOS 5.10 Last change: 17 Jul 2006 5
Man(1) output converted with
man2html and wrapped by fishsponge
This page was generated on Wed Sep 12 21:37:07 GMT 2007
|
Your favourite pages:
No pages logged yet. Trying to save cookie... Top 10 most popular pages:
sqlite3 man page (5084 hits) (openSUSE 10.2)
adv_cap_autoneg man page (4749 hits) (Solaris 10 11_06)
CPAN man page (4469 hits) (Suse Linux 10.1)
svn man page (4249 hits) (FreeBSD 6.2)
ssh man page (4249 hits) (Suse Linux 10.1)
ssh-socks5-proxy-connect man page (2206 hits) (Solaris 10 11_06)
startproc man page (2201 hits) (Suse Linux 10.1)
netcat man page (2159 hits) (Suse Linux 10.1)
pprosetup man page (2017 hits) (Solaris 10 11_06)
signal man page (2009 hits) (Suse Linux 10.1)
|