1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2003
    Rep Power

    Simple Insert from a Bash script

    This is driving me crazy. I thought this was an easy thing to do. But not so much .

    So I am trying to insert 4 pieces of info to a small table in a remote Maria DB. here is the code

    enterdata=$(ssh RcyEJtB2@xxx.xxx.xxx.xxx 'mysql -N -u BCSmDPIq -pMXGz1h3Q -se "Insert INTO Systembackup
    .backup (dealername,location,deploynumber,active)Values('Willy','Office','562356','1')"')
    I have been using the connection to the DB for a select query with no issues. With the Insert I get:

    Unknown column 'Willy' in 'field list' There is no WILLY column. I am not referencing the id column
    since it is a auto increment field

    Can someone help put me out of my misery??

    Thanks so much
  2. #2
  3. Contributing User
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Mar 2006
    Rep Power
    I suspect you might want to look at your single quotes, you have an 'outer' se' that wrap the whole sql statement, then you have 'inner' sets that delimit the literal values of the insert data. It's been a loooooong time since i have dabbled with *nix but, maybe, use \' on the 'inner' sets?
    The moon on the one hand, the dawn on the other:
    The moon is my sister, the dawn is my brother.
    The moon on my left and the dawn on my right.
    My brother, good morning: my sister, good night.
    -- Hilaire Belloc

IMN logo majestic logo threadwatch logo seochat tools logo