help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Help-bash] How to print a bash variable in the most succinct way?


From: Peng Yu
Subject: [Help-bash] How to print a bash variable in the most succinct way?
Date: Tue, 9 Aug 2016 18:22:03 -0500

Hi, x is shown in the following way.

~$ x=(a \' -)
~$ declare -p x
declare -a x='([0]="a" [1]="'\''" [2]="-")'

But the most succinct form should be the following. When I source a
file containing the following line, I got the same array x. Is there
any easy to get a line like the following.

declare -a x='(a "'\''" -)'

Further, is there a way to get the string of "a \' -".

-- 
Regards,
Peng



reply via email to

[Prev in Thread] Current Thread [Next in Thread]