RTEMS Logo

RTEMS 4.9.4 On-Line Library


General Commands echo - produce message in a shell script

PREV UP NEXT Bookshelf RTEMS Shell User's Guide

2.2.3: echo - produce message in a shell script

SYNOPSYS:

echo [-n | -e] args ...

DESCRIPTION:

echo prints its arguments on the standard output, separated by spaces. Unless the -n option is present, a newline is output following the arguments. The -e option causes echo to treat the escape sequences specially, as described in the following paragraph. The -e option is the default, and is provided solely for compatibility with other systems. Only one of the options -n and -e may be given.

If any of the following sequences of characters is encountered during output, the sequence is not output. Instead, the specified action is performed:

\b
A backspace character is output.
\c
Subsequent output is suppressed. This is normally used at the end of the last argument to suppress the trailing newline that echo would otherwise output.
\f
Output a form feed.
\n
Output a newline character.
\r
Output a carriage return.
\t
Output a (horizontal) tab character.
\v
Output a vertical tab.
\0digits
Output the character whose value is given by zero to three digits. If there are zero digits, a nul character is output.
\\
Output a backslash.

EXIT STATUS:

This command returns 0 on success and non-zero if an error is encountered.

NOTES:

The octal character escape mechanism (\0digits) differs from the C lan- guage mechanism.

There is no way to force echo to treat its arguments literally, rather than interpreting them as options and escape sequences.

EXAMPLES:

The following is an example of how to use echo:

SHLL [/] $ echo a b c
a b c
SHLL [/] $ echo

CONFIGURATION:

This command is included in the default shell command set. When building a custom command set, define CONFIGURE_SHELL_COMMAND_ECHO to have this command included.

This command can be excluded from the shell command set by defining CONFIGURE_SHELL_NO_COMMAND_ECHO when all shell commands have been configured.

PROGRAMMING INFORMATION:

The echo is implemented by a C language function which has the following prototype:

int rtems_shell_rtems_main_echo(
  int    argc,
  char **argv
);

The configuration structure for the echo has the following prototype:

extern rtems_shell_cmd_t rtems_shell_ECHO_Command;

ORIGIN:

The implementation and portions of the documentation for this command are from NetBSD 4.0.


PREV UP NEXT Bookshelf RTEMS Shell User's Guide

Copyright © 1988-2008 OAR Corporation