title: Escape certain characters in shell script
body: <p>This is my below shell script which I am using to query the hive tables and I saved this file as <code>test4.sh</code></p>
  
  <pre><code>#!/bin/bash
  
  DATE_YEST_FORMAT1=`perl -e 'use POSIX qw(strftime); print strftime "%Y-%m-%d",localtime(time()- 3600*96);'`
  echo $DATE_YEST_FORMAT1
  
  QUERY1=`hive -e "
  set mapred.job.queue.name=hdmi-technology;
  SELECT split(ckey, '\\|') AS t1
                      ,created_time
                  FROM (
                      SELECT CONCAT (
                              buyer_id
                              ,'|'
                              ,item_id
                              ) AS ckey
                          ,created_time
                      FROM dw_checkout_trans
                      WHERE to_date(from_unixtime(cast(UNIX_TIMESTAMP(created_time) AS BIGINT))) = '$DATE_YEST_FORMAT1' distribute BY ckey sort BY ckey
                          ,created_time DESC
                      ) a
                  WHERE rank(ckey) &lt; 1;"`
  </code></pre>
  
  <p><strong>Problem Statement:-</strong></p>
  
  <p>I am running the above shell script as-</p>
  
  <pre><code>bash -x test4.sh
  </code></pre>
  
  <p>If you see this line in the above <code>hive sql query</code>:  </p>
  
  <pre><code>**SELECT split(ckey, '\\|') AS t1**.  
  </code></pre>
  
  <p>Do I need to escape slash sign to make it to work in shell script?</p>