Skip to main content
Spelling
Source Link
AReddy
  • 3.2k
  • 6
  • 37
  • 77

I'm using the jq tool to handle some JSON in bash. 
Just one problem, while using this line:

PB_ACL="acl="`echo $IMGREQ | jq -r'.data.acl'` 

Result:

echo $PB_ACL // acl= 

The expected value jq has to filter out is: "acl":"public-read" But it's not working now. I think it has to to with the dash (-) symbol.

How do I excapeescape such incoming string data?

I'm using the jq tool to handle some JSON in bash. Just one problem, while using this line:

PB_ACL="acl="`echo $IMGREQ | jq -r'.data.acl'` 

Result:

echo $PB_ACL // acl= 

The expected value jq has to filter out is: "acl":"public-read" But it's not working now. I think it has to to with the dash (-) symbol.

How do I excape such incoming string data?

I'm using the jq tool to handle some JSON in bash. 
Just one problem, while using this line:

PB_ACL="acl="`echo $IMGREQ | jq -r'.data.acl'` 

Result:

echo $PB_ACL // acl= 

The expected value jq has to filter out is: "acl":"public-read" But it's not working now. I think it has to to with the dash (-) symbol.

How do I escape such incoming string data?

Post Closed as "Not suitable for this site" by G-Man Says 'Reinstate Monica', Ramesh, chaos, X Tian, don_crissti
Source Link

How to escape an input string in Bash

I'm using the jq tool to handle some JSON in bash. Just one problem, while using this line:

PB_ACL="acl="`echo $IMGREQ | jq -r'.data.acl'` 

Result:

echo $PB_ACL // acl= 

The expected value jq has to filter out is: "acl":"public-read" But it's not working now. I think it has to to with the dash (-) symbol.

How do I excape such incoming string data?