print

For strings.

Print the given values to stdout.

Command Type

built-in

Signature

> print {flags} ...rest

Flags

  • --no-newline, -n: Print without inserting a newline for the line ending.
  • --stderr, -e: Print to stderr instead of stdout.
  • --raw, -r: Print without formatting (including binary data).

Parameters

  • ...rest: The values to print.

Input/output types:

input output
nothing nothing
any nothing

Examples

Print ‘hello world’

> print "hello world"

Print the sum of 2 and 3

> print (2 + 3)

Print ‘ABC’ from binary data

> 0x[41 42 43] | print --raw

Notes

Unlike echo, this command does not return any value (print | describe will return “nothing”). Since this command has no output, there is no point in piping it with other commands.

print may be used inside blocks of code (e.g.: hooks) to display text during execution without interfering with the pipeline. In protocol modes (--lsp, --mcp), print always writes to stderr to keep stdout reserved for protocol messages.

Ported from nushell/nushell.github.io. Copyright (c) 2021 Nushell Project. MIT License.