Sujet : Re: bash aesthetics question: special characters in reg exp in [[ ... =~~ ... ]]
De : janis_papanagnou+ng (at) *nospam* hotmail.com (Janis Papanagnou)
Groupes : comp.unix.shellDate : 23. Jul 2024, 18:48:42
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v7omtd$19ng6$1@dont-email.me>
References : 1 2 3 4 5
User-Agent : Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
On 23.07.2024 18:13, Kenny McCormack wrote:
In article <v7ofkl$18d66$1@dont-email.me>,
Janis Papanagnou <janis_papanagnou+ng@hotmail.com> wrote:
On 23.07.2024 13:46, Kenny McCormack wrote:
One thing that bash does that's annoying is puts semicolons on the end of
(almost) every line.
Ouch!
I have, on occasion, had to recover a function from
the bash pretty print (*), and one of the things that needs to be done is
to remove those extraneous semicolons.
(*) BTW, the command I use is "type". I.e., "type funName" displays the
function definition of function funName. That seems to be the same as your
use of "typeset".
I started tests with 'type' but the result was something undesirable
(forgot already what it was), so I tried the 'typeset -f' which had
better results (with ksh, zsh, at least).
Actually I was just playing around, since your post made me curious.
(I almost never inspect function definitions using one method or the
other. The interesting functions are non-trivial and already tested,
so interactively looking them up makes no sense for me. And other
functions are part of shell programs, either monolithic or used as
lib.) But as a side-effect of my tries I noticed another bug in the
ksh93u+m shell that I'm using. :-/ (But I'm digressing.)
But ksh displays it as it had been typed in; a raw format.
If you define your function, say, as multi-line code you
also see it that way, there's no processing at that point
(or the original retained as copy). I didn't expect that.
Yep. Note also that bash reformats something like:
cmd1 &&
cmd2 &&
cmd3
to:
cmd1 && cmd2 && cmd3
which is annoying.
Indeed. It reminds me the philosphy that I often noticed in MS (and
nowadays also in Linux software, sadly) contexts; they seem to think
their auto-changes are better than the intention of the programmer.
(**) I've hacked the bash source code for less. So, yeah, it is possible.
Ah, okay. (Would not be my preferred way. :-)
Janis