0

I am trying to construct a command(using args) that will be executed when called with eval and it looks as follows

 cmd=$'dbconn -tabs testdb dev "INSERT INTO dataset(\'id\', \'description\', \'source_table\', \'class_id\') VALUES(\'1\', \'data\', \'testd\', \'income\')"'

How can i print the output without the char like \ and sometimes "$" for verification

expected output

dbconn -tabs testdb dev "INSERT INTO dataset('id', 'description', 'source_table', 'class_id') VALUES('1', 'data', 'testd', 'income')"
Ram
  • 189
  • 1
  • 4
  • 19
  • check https://unix.stackexchange.com/questions/444946/how-can-we-run-a-command-stored-in-a-variable – Diego Torres Milano Oct 28 '21 at 16:48
  • Constructing commands as strings and then `eval`ing them is a good way to wind up with weird and confusing bugs. If you need to construct a command, storing it as an array is almost always better. – Gordon Davisson Oct 28 '21 at 17:14

0 Answers0