How can we append text in a file via a one-line command without using io redirection?
If you don't mind using sed then,
$ cat test this is line 1 $ sed -i '$ a\this is line 2 without redirection' test $ cat test this is line 1 this is line 2 without redirection
As the documentation may be a bit long to go through, some explanations :
-imeans an inplace transformation, so all changes will occur in the file you specify
$is used to specify the last line
ameans append a line after
\is simply used as a delimiter