xref: /illumos-gate/usr/src/man/man1/print.1 (revision 0a554e9f)
te
Copyright (c) 2008 Sun Microsystems, Inc. - All Rights Reserved.
Copyright 1989 AT&T
Portions Copyright (c) 1982-2007 AT&T Knowledge Ventures
The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
PRINT 1 "December 28, 2020"
NAME
print - shell built-in function to output characters to the screen or window
SYNOPSIS
"ksh"
print [-Rnprsu [n]] [arg]...
"ksh93"
print [-Renprs] [-f format] [-u fd] [string...]
DESCRIPTION
"ksh"
The shell output mechanism. When no options are specified, or when an option followed by ' a - is specified, or when just - is specified, the arguments are printed on standard output as described by echo(1).
"ksh93"
By default, print writes each string operand to standard output and appends a NEWLINE character.

Unless, the -r, -R, or -f option is specified, each \e character in each string operand is processed specially as follows: \ea

Alert character.

\eb

Backspace character.

\ec

Terminate output without appending NEWLINE. The remaining string operands are ignored.

\eE

Escape character (ASCII octal 033).

\ef

FORM FEED character.

\en

NEWLINE character.

\et

Tab character.

\ev

Vertical tab character.

\e\e

Backslash character.

\e0x

The 8-bit character whose ASCII code is the 1-, 2-, or 3-digit octal number x.

OPTIONS
"ksh"
The following options are supported by ksh: -n

Suppresses new-line from being added to the output.

-r-R

Raw mode. Ignore the escape conventions of echo. The -R option prints all subsequent arguments and options other than -n.

-p

Cause the arguments to be written onto the pipe of the process spawned with |& instead of standard output.

-s

Cause the arguments to be written onto the history file instead of standard output.

-u [ n ]

Specify a one digit file descriptor unit number n on which the output is placed. The default is 1.

"ksh93"
The following options are supported by ksh93: -e

Unless -f is specified, process \e sequences in each string operand as described above. This is the default behavior. If both -e and -r are specified, the last one specified is the one that is used.

-f format

Write the string arguments using the format string format and do not append a NEWLINE. See printf(1) for details on how to specify format. When the -f option is specified and there are more string operands than format specifiers, the format string is reprocessed from the beginning. If there are fewer string operands than format specifiers, then outputting ends at the first unneeded format specifier.

-n

Do not append a NEWLINE character to the output.

-p

Write to the current co-process instead of standard output.

-r

-R

Do not process \e sequences in each string operand as described above. If both -e and -r are specified, the last one specified is the one that is used.

-s

Write the output as an entry in the shell history file instead of standard output.

-u fd

Write to file descriptor number fd instead of standard output. The default value is 1.

EXIT STATUS
The following exit values are returned: 0

Successful completion.

>0

Output file is not open for writing.

SEE ALSO
echo(1), ksh(1), ksh93(1), printf(1), attributes(5)