Cannot Run SQL INSERT in MySQL
You are using the wrong quotes for the SQL

SUGGESTION #1 : Use Single Quotes for the SQL

sudo mysql -e "USE books; INSERT INTO authors (id,name,email) VALUES(1,'test','gmail.com');"


SUGGESTION #2 : Escape Double Quotes for SQL with Backslash (\)

sudo mysql -e "USE books; INSERT INTO authors (id,name,email) VALUES(1,\"test\",\"gmail.com\");"


The confusion is caused by the double quotes you are using for the sudo and for the SQL

GIVE IT A TRY !!!