help with sed adding line to end of file

 sed '$a\
 hello' books

hi i am trying to use sed to append hello to the end of the file books, but for some reason i can't get it work. It keeps sayin command garbled. Anyone know what I'm doing wrong. this is in a ksh script as well.

Works for me, though I'm on GNU Bash.
Please post the exact command that you're using and the error message that you're getting.

What OS are you on? Are you on Solaris? If so, use /usr/xpg4/bin/sed
The \ should be the last character on the line, but that is the case in your example.

the below command will append hello to your file (books) ( as a last line )

 
echo "hello" >> books