W3cubDocs

/Nushell

save for filesystem

Save a file.

Signature

> save {flags} (filename)

Flags

  • --stderr, -e {path}: the filename used to save stderr, only works with -r flag
  • --raw, -r: save file as raw binary
  • --append, -a: append input to the end of the file
  • --force, -f: overwrite the destination
  • --progress, -p: enable progress bar

Parameters

  • filename: the filename to use

Input/output types:

input output
any nothing

Examples

Save a string to foo.txt in the current directory

>'save me'|savefoo.txt

Append a string to the end of foo.txt

>'append me'|save--appendfoo.txt

Save a record to foo.json in the current directory

> { a:1, b:2 } |savefoo.json

Save a running program's stderr to foo.txt

>do-i {} |savefoo.txt--stderrfoo.txt

Save a running program's stderr to separate file

>do-i {} |savefoo.txt--stderrbar.txt

Copyright © 2019–2023 The Nushell Project DevelopersLicensed under the MIT License.
https://www.nushell.sh/commands/docs/save.html