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
Post a Comment