Skip to content

Write stdin to a given path, creating directories as necessary.

Notifications You must be signed in to change notification settings

nejucomo/writefile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

writefile

Write stdin to a given path, creating directories as necessary.

Examples

$ echo 'Hello World!' | writefile greeting.txt

This is similar to a ubiquitous shell idiom:

$ echo 'Hello World!' > greeting.txt

However, writefile is convenient in various cases, such as:

Creating Intermediate Directories

$ echo 'Hello World!' | writefile ./intermediate/directories/created/as/necessary/greeting.txt

With sudo

Generate contents with an unprivileged process, but write to a root-owned file:

$ do-unprivileged-thing-to-generate-contents | sudo writefile root-owned-path

With ssh

Generate contents locally and write to a remote file:

$ generate-local-data | ssh myhost writefile

About

Write stdin to a given path, creating directories as necessary.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages