Ashley
Ashley

Reputation: 1629

How to print value of a shell variable where the value has double quotes

Lets say i have a shell variable like the below with the value :-

myvar="abc"xyz

Now if i print the value of this variable myvar, the output i get is abcxyz Is there a way to get the exact output that also includes the quotes. I tried several ways to escape double quotes etc but unable to find a way to do it.

Upvotes: 0

Views: 95

Answers (1)

sordnay
sordnay

Reputation: 121

use single quotes:

myvar='"abc"xyz'

Upvotes: 1

Related Questions