Find the answer to your Linux question:
Results 1 to 2 of 2
Hi, i have this script below. When i execute it, i get these errors: Code: 89.17.206.129 ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; ...
  1. #1
    Just Joined!
    Join Date
    Apr 2007
    Posts
    22

    Bash with MySQL sintax

    Hi,

    i have this script below. When i execute it, i get these errors:

    Code:
    89.17.206.129
    ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.206.129
    )' at line 5
    89.17.206.130
    ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.206.130
    )' at line 5
    89.17.206.131
    ERROR 1064 (42000) at line 1: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '.206.131
    )' at line 5

    I dont get any error when i write manually at mysql prompt this:

    Code:
    mysql> INSERT INTO `pingp22`.`ip` ( `ip` ) VALUES (  "89.17.206.129" );
    This is the bash code:

    Code:
    IPS="$(seq -f "89.17.206.%.0f" 129 189) $(seq -f "89.17.219.%.0f" 65 126)"
    
    for i in ${IPS}
    do
    if [ -z "$(nmap -p 22 $i |grep closed)" ]; then
    
    BD="pingp22" 
    
    echo $i
    
    mysql -uroot -pm -D $BD -Bse 'INSERT INTO `pingp22`.`ip` (
    
    `ip`
    )
    VALUES (
     '$i'
    );
    '
    
    fi
    done
    Any idea?


    Ciao

  2. #2
    Just Joined!
    Join Date
    Apr 2007
    Posts
    22
    Ok, i forgot quoting $i this way "$i".

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...