Path: ...!news.misty.com!weretis.net!feeder9.news.weretis.net!xmission!nnrp.xmission!.POSTED.shell.xmission.com!not-for-mail From: gazelle@shell.xmission.com (Kenny McCormack) Newsgroups: comp.unix.shell Subject: Re: bash aesthetics question: special characters in reg exp in [[ ... =~~ ... ]] Date: Tue, 23 Jul 2024 16:13:40 -0000 (UTC) Organization: The official candy of the new Millennium Message-ID: References: Injection-Date: Tue, 23 Jul 2024 16:13:40 -0000 (UTC) Injection-Info: news.xmission.com; posting-host="shell.xmission.com:166.70.8.4"; logging-data="4018543"; mail-complaints-to="abuse@xmission.com" X-Newsreader: trn 4.0-test77 (Sep 1, 2010) Originator: gazelle@shell.xmission.com (Kenny McCormack) Bytes: 3082 Lines: 52 In article , Janis Papanagnou wrote: >On 23.07.2024 13:46, Kenny McCormack wrote: >> In article , >> Janis Papanagnou wrote: >> ... >>> Both (ksh & zsh) seem to show "better aesthetics". >> >> Indeed, it does. That is how it should work. > >BTW, it's interesting that bash and zsh both reformat (sort >of pretty-print) the code (when using 'typeset -f'), only >that zsh keeps that literal '\n'. This may show a way (by >zsh example) how to follow Kaz' suggestion of patching the >bash. (But, frankly, I'm not sure it was meant seriously. (see ** below)) Yes. ksh seems to dump it out literally as is (as it was typed), but bash (and, I guess also zsh - I have zero knowledge or experience of zsh) pretty prints it. But it seems zsh does a prettier print than bash. One thing that bash does that's annoying is puts semicolons on the end of (almost) every line. 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". >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. (**) I've hacked the bash source code for less. So, yeah, it is possible. -- The randomly chosen signature file that would have appeared here is more than 4 lines long. As such, it violates one or more Usenet RFCs. In order to remain in compliance with said RFCs, the actual sig can be found at the following URL: http://user.xmission.com/~gazelle/Sigs/ThePublicGood