help-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Official bash minifier


From: Peng Yu
Subject: Re: Official bash minifier
Date: Sun, 7 Feb 2021 16:41:35 -0600

I don't find --pretty-print option on the man page of bash. Is it an
undocumented feature?

Although it is not relevant to the minifier function that I am asking,
I think that pretty-print probably should be implemented as a separate
command (maybe bashpp) as there should some options work along with it
(e.g., indentation size). Those control options for pretty-print has
nothing to do with the main function of bash. For this reason, the
pretty-print feature is better to be separated from the main bash
program.

$ cat main.sh
#!/usr/bin/env bash

echo x   a  c
function myfun {  echo x;          }
$ bash --pretty-print ./main.sh

echo x a c
myfun ()
{
    echo x
}



On 2/7/21, Chet Ramey <chet.ramey@case.edu> wrote:
> On 2/6/21 7:51 PM, Peng Yu wrote:
>> Is there a robust minifier that works most of the time without
>> changing the behavior of the original bash script? Thanks.
>
> I have no idea. It's not an area of interest.
>
> If you want to see what bash can do for you, run it with the
> `--pretty-print' option on a shell script. That's not really a
> `minifier', though, but I confess not knowing exactly what
> that's supposed to mean.
>
> --
> ``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/
>


-- 
Regards,
Peng



reply via email to

[Prev in Thread] Current Thread [Next in Thread]