One liner in bash (for example using sed) to append a line before the last line in a file.
Example
Old File
foo bar
foo bar
foo bar
foo bar
New file
foo bar
foo bar
foo bar
--new foo bar
foo bar
I tried sed on OSX like that
sed '$ i --new foo bar' file.sh
I get this error command i expects \ followed by text. Any ideas?