|
From: | Chet Ramey |
Subject: | Re: [PATCH] compgen -V option (store output in array) |
Date: | Mon, 17 Apr 2023 11:59:06 -0400 |
User-agent: | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 |
On 4/13/23 4:57 AM, Koichi Murase wrote:
2023年4月13日(木) 17:31 Grisha Levit <grishalevit@gmail.com>:Since the predominant use case for compgen is generating output that then gets split back up into an array, it seems like it would be nice to have an option that avoids the extra steps (and their associated pitfalls)I have related but unsubmitted patches that I made before. I attach them. This adds a new flag option `-z` that makes the output of `compgen' separated by NUL This is useful when we want to process the candidates of compgen (that may contain newlines as a part of a candidate) using external commands such as `sort -z'.
Once you have -V, isn't -z superfluous? It's just compgen -V varname options word printf '%s\0' "${varname[@]}" right? What am I missing? -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/
[Prev in Thread] | Current Thread | [Next in Thread] |