0

I am running a script it has:

...
echo 3:${WRITE_TIME}
WRITE_TIME_QUOTES=\"${WRITE_TIME}\"
echo 4:${WRITE_TIME_QUOTES}
${ADDR_BEELINE}/beeline ... --hivevar write_time=${WRITE_TIME_QUOTES} ;hive_status=$?

I pass the date time with spaces as argument to this script and both the 2 variables: WRITE_TIME and WRITE_TIME_QUOTES are displayed as expected:

3:2021-11-24 17:00:00
4:"2021-11-24 17:00:00"

The command is expected to be:

/home/data/hive/bin/beeline ... --hivevar write_time="2021-11-24 17:00:00"

However, the command actually executed comprises extra quotes which are not written in the script:

/home/data/hive/bin/beeline ... --hivevar 'write_time="2021-11-24' '17:00:00"'

I did not put them at all, why did they appear and how to get rid of them? Any help is appreciated.

6
  • 2
    It looks like you just want beeline ... write_time="${WRITE_TIME}"
    – muru
    Nov 24 '21 at 10:33
  • hi @muru Thanks for your reply. I retried beeline ... --hivevar write_time="${WRITE_TIME_QUOTES}" but the commands becomes --hivevar 'write_time="2021-11-24 17:00:00"' Nov 24 '21 at 10:35
  • 2
    Are you using set -xv to check the command? It adds quotes for clarity, they aren't in fact sent to the command.
    – choroba
    Nov 24 '21 at 10:41
  • 1
    @user2894829 double check my comment, I used WRITE_TIME
    – muru
    Nov 24 '21 at 11:03
  • 2
    Seems like the same issue as unix.stackexchange.com/questions/658837/…
    – muru
    Nov 24 '21 at 12:19

Browse other questions tagged or ask your own question.