Path: ...!news.mixmin.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Janis Papanagnou Newsgroups: comp.unix.shell Subject: Re: bash aesthetics question: special characters in reg exp in [[ ... =~~ ... ]] Date: Tue, 23 Jul 2024 18:48:42 +0200 Organization: A noiseless patient Spider Lines: 59 Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Injection-Date: Tue, 23 Jul 2024 18:48:45 +0200 (CEST) Injection-Info: dont-email.me; posting-host="813c436e4ebdd14f30c57dbc5b95f784"; logging-data="1367558"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19uAfS3GyD2yDnMUkcRUT9q" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 Cancel-Lock: sha1:d0BfHYbSZDmGOyIyG2qZ7QPAOxA= X-Enigmail-Draft-Status: N1110 In-Reply-To: Bytes: 3373 On 23.07.2024 18:13, Kenny McCormack wrote: > In article , > Janis Papanagnou 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