[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: declare -f does not output esac pattern correctly
From: |
Chet Ramey |
Subject: |
Re: declare -f does not output esac pattern correctly |
Date: |
Tue, 27 Feb 2024 11:28:22 -0500 |
User-agent: |
Mozilla Thunderbird |
On 2/26/24 6:50 PM, Emanuele Torre wrote:
Hello.
I have noticed that declare -f does not output valid code when a
pattern is `esac'.
Thanks for the report. More precisely, if the first word in the pattern
list is the literal string "esac".
"The grammar shows that reserved words can be used as patterns, even if one
is the first word on a line. Obviously, the reserved word esac cannot be
used in this manner."
To use esac as a pattern you need to use the (esac) syntax,
No, you can use \esac as well (or any quoting variant). But if you do
use the leading paren to prevent `esac' from being recognized as a reserved
word, the command printing code should be able to preserve that.
Chet
--
``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/