I am trying to build a query string in bash to execute in a sqoop command.
Here is what I have so far:
d1=$(date +'%Y%m')
STR="Select * from Table1 where dtmn = "
Query=$STR$d1
Now if I use this it will select * from my directory vs build this as a string. If I use \ to escape then when I call it using echo I get:
d1=$(date +'%Y%m')
STR="Select \* from Table1 where dtmn = "
Query=$STR$d1
echo $Query
['Select \\* from Table1 where dtmn = 202006']
This breaks in my sqoop command as soon as it gets to the \.
What do I need to do to dynamically build this query string in bash based on the date, and execute it in a sqoop command?