Bash : Command line argument issue <pre><code>#usernamecheck.sh #!/bin/bsh DBUSER=user_1 DBPASSWORD=XXXXX DBSOURCENAME=database_1 DBNAME=database_1 DBNAME1=snapshot_v DBSERVER=X.X.X.X DBCONN="-h ${DBSERVER} -u ${DBUSER} --password=${DBPASSWORD}" echo "select user from device_id where ip='1.1.1.1'|mysql $DBCONN $DBNAME </code></pre> <p>The output of executing this script is:</p> <pre><code>user ---- JohnDoe </code></pre> <p>The above bash script which gives me user name of IP (1.1.1.1). I would like to pass the IP as a command line argument. I tried,</p> <pre><code>echo "select user from device_id where ip=$1|mysql $DBCONN $DBNAME </code></pre> <p>and executed like </p> <pre><code>$./usernamecheck.sh '1.1.1.1' </code></pre> <p>I get the error message:</p> <blockquote> <p>Error in SQL syntax</p> </blockquote> <p>Hope i'm passing the command line argument correct. But not sure, why does this error pop up?</p>