How, in a bash script, could I tell whether an ingres database contains a particular table?
I think I want something like this:
sql $db << ENDSQL | grep 'TRUE' > /dev/null
select 'TRUE' from iitables where table_name like '$tablename%'
\p\g
ENDSQL
result=$?
but this is always returning 1
(not found). A literal 'mytable%'
works, so I think it's something in my quoting (or lack of it).
The \p
prints my SQL statement, and the $tablename is expanded even though it's inside the single quotes, so it's not that.
Any suggestions appreciated.