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

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -