Bash和双引号转义

如果我在shell中运行这样的东西:

curl -I http://example.com -H "If-None-Match: \"da8e7e-557a9-4cbc6f2e68780\"" 

我得到正确的结果,但是当我试图在我的bash脚本中运行它:

 http_code=$(curl -I $SELL_URI -H "If-None-Match: "\$etag\"" | grep ...) 

我的curl -I $SELL_URI -H "If-None-Match: "\"$etag\"看起来像这样:

 $"-None-Match: "da8e7e-557a9-4cbc6f2e68780 

你可以把标题放在单引号中,如下所示:

 curl -I http://example.com -H 'If-None-Match: "da8e7e-557a9-4cbc6f2e68780"'