In a BASH
script, I am reading in a list of strings from a text file that may contain apostrophe ('
). Each string in the list is saved to a BASH
environment variable that is passed to my psql query. I have tried everything so far but still when I loop through the list, if I counter an apostrophe, my query fails.
Here is a snipit of the code that fails:
SELECT * FROM table_1 WHERE id = $myid AND name = '$namelist';
namelist is the file that has the entries which may contain apostrophes.
Thanks for you help