sql - Heredocs, variables and single quotes in BASH and MySQL -


i'm trying send data remote mysql database using bash script on gnu/linux, various errors.. here's line that's not working:

mysql --host=192.168.0.100 --user=petercapaldi --password=mypassword mystartrekcharacterbase << eof insert myfourlegs values ('$person','$thetime','$thetime','$thedate','$dayofweek'); eof 

and (just in case):

mysql --host=192.168.0.100 --user=petercapaldi --password=mypassword mystartrekcharacterbase << eof insert myfourlegs values (\047$person\047,\047$thetime\047,\047$thetime\047,\047$thedate\047,\047$dayofweek\047); eof 

scrap that. fault - missed first field in database. single quotes work should heredocs.. (i.e. '$variable' prints 'myvariable' $variable prints myvariable).


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -