Quantcast
Channel: How to input text into a new text file using nano from command line? - Unix & Linux Stack Exchange
Viewing all articles
Browse latest Browse all 4

How to input text into a new text file using nano from command line?

$
0
0

How to input text into a new text file using nano from command line?

I would like the same as with the following, but using nano:

echo 'Hello, world.' >foo.txt

Result:

  1. nano is not capable of handling non-interactive text input.
  2. echo is available in every Linux/Unix system, while nano is not installed by default in every Linux/Unix system. Echo can be also used in shell scripts, too.

Conclusion: The most compatible solution is to use

echo 'Hello, world.' >foo.txt

as solution to create a file and fill with input text non-interactively.


Viewing all articles
Browse latest Browse all 4

Latest Images

Trending Articles





Latest Images