|
| From: | Chris F.A. Johnson |
| Subject: | Re: [Help-bash] How to print a bash variable in the most succinct way? |
| Date: | Tue, 16 Aug 2016 20:29:03 -0400 (EDT) |
| User-agent: | Alpine 2.10 (DEB 1266 2009-07-14) |
On Tue, 16 Aug 2016, Peng Yu wrote:
On Tue, Aug 16, 2016 at 2:56 PM, Chet Ramey <address@hidden> wrote:On 8/16/16 3:21 PM, Peng Yu wrote:How to only generate variables that are modifiable (i.e., not readonly)?Generate a list of all variables. Generate a list of readonly variables. Do a diff.How to generate a list of the names of the readonly variables? `readonly` will print both the names and their values. I will run into the same problem when there are $'\n' in their values.
readonly -p| awk -F "[= ]" '/^declare/ {print $3}'
--
Chris F.A. Johnson, <http://cfajohnson.com>
| [Prev in Thread] | Current Thread | [Next in Thread] |