tags:

views:

46

answers:

1

Hi,

Can anybody show me how to escape double quote inside a double string in bash?

For example in my shell script

#!/bin/bash

dbload="load data local infile \"'gfpoint.csv'\" into table $dbtable FIELDS TERMINATED BY ',' ENCLOSED BY '\"' LINES TERMINATED BY \"'\n'\" IGNORE 1 LINES"

I can't get the ENCLOSED BY '\"' with double quote escape correctly. I can't use single quote for my variable because i want to use variable $dbtable.

Thanks very much for your help.

A: 

Use a backslash:

echo "\""     # Prints one " character.
Peter