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:
- nano is not capable of handling non-interactive text input.
- 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.