could you please tell me how I (a Linux-User) can add text to the last line of a text-file?
I have this so far:
APPEND='Some/Path which is/variable'
sed '${s/$/$APPEND/}' test.txt
It works, but $APPEND is added insted of the content of the variable. I know the reason for this is the singe quote (‘) I used for sed.
But when I simply replace ‘ by “, no text gets added to the file.
Do you know a solution for this? I don’t insist on using sed, it’s only the first command line tool that came in my mind. You may use every standard command line program you like.
edit: I’ve just tried this:
$ sed '${s/$/'"$APPEND/}" test.txt
sed: -e Ausdruck #1, Zeichen 11: Unbekannte Option für `s'
This was what I needed.