sh
sh copied to clipboard
A shell parser, formatter, and interpreter with bash support; includes shfmt
Before: ```sh case "$x" in (0) echo 'none!' ;; (1) echo 'it'"'"'s one!' ;; (*) echo 'something!' ;; esac ``` After `shfmt -p -s`: ```sh #!/bin/sh set -e -f -u...
I think functional options are an interesting idea, and can be a good fit in certain scenarios, but in practice they're overkill and kinda awkward for APIs like our parser...
Hi all, **shfmt** currently changes \`command\` into $(command). Couldn't an option be added to disable all kind of syntax substitutions, and therefore keep the current syntax? The rationale is that...
Once Go 1.17 is out, we'll be able to drop support for Go 1.15. Then we'll be able to use the new APIs in Go 1.16, such as the `fs.FS`...
When trying to format the following file: ``` #!/bin/bash files=([^_]*.txt) ``` shfmt fails with `test.sh:2:9: ^ must follow an expression`. I'm not sure what that means. The manual describes the...
Split from https://github.com/mvdan/sh/issues/513, since this one can be reproduced by @theclapp on his Mac machine. It doesn't seem to be the same issue that we're seeing with pseudo-TTYs on CI,...
Hi, Running this sample on Windows 10 computer. I reproduce unexpected behavior when using array and subshell. I create a small example to reproduce behavior. ```sh # gosh.test.sh fn() {...
Given `let.sh` as the input file: ``` #!/bin/bash let "varone=1" "vartwo=++varone"; echo $varone, $vartwo let "myvar=16
Given `echo.sh` as the file input: ``` $ cat echo.sh #!/bin/bash set -ex s="The default format for %v is: bool: %t int, int8 etc.: %d uint, uint8 etc.: %d, %#x...
Using the script below as file input: ``` $ cat while.sh #!/bin/bash set -ex x=1 while [ $x -le 5 ] do echo "Welcome $x times" x=$(( $x + 1...