Passing a string saved in a bash variable with an apostrophe to psql query using a bash script -


in bash script, reading in list of strings text file may contain apostrophe ('). each string in list saved bash environment variable passed psql query. have tried far still when loop through list, if counter apostrophe, query fails.

here snipit of code fails:

select * table_1 id = $myid , name = '$namelist'; 

namelist file has entries may contain apostrophes.

thanks help

use prepared sql statement avoid sql injection.

you may need solution this post.


Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -