Append output of a command to file without newline
An very old topic, but even now i have been needed to do this (on limited command resources) and that one (replied) command havent been working for me due to its length.
Appending to a file can be done also by using file-descriptors:
touch file.txt
(create new blank file),exec 100<> file.txt
(new fd with id 100),echo -n test >&100
(echo test to new fd)exec 100>&-
(close new fd)
Appending starting from specyfic character can be done by reading file from certain point eg.
exec 100 <> file.txt
- new descriptorread -n 4 < &100
- read 4 charactersecho -n test > &100
- append echo test to a file starting from forth character.exec 100>&-
- (close new fd)