sh icon indicating copy to clipboard operation
sh copied to clipboard

A shell parser, formatter, and interpreter with bash support; includes shfmt

Results 129 sh issues
Sort by recently updated
recently updated
newest added

Hi @mvdan, I have a formatting suggestion involving if-blocks. Instead of doing this: ```sh a='aaa' b='bbb' c='ccc' if [[ $a == 'aaa' && $b == 'bbb' && $c == 'ccc'...

make a file like such, named `foo`: ``` echo "bar" ``` ``` $ chmod +x foo $ bash -c "./foo" hi ``` when I run this with `strace -f bash...

Would it be possible to easily emulate the `--force-function-style` behavior of beautysh? That seems to be the only missing feature to use this as a replacement. ``` --force-function-style FORCE_FUNCTION_STYLE, -s...

This implements the -s option for the read builtin using the ReadPassword function in the golang.org/x/term package. This is a less featureful (and as a result, simpler) implementation of the...

Implement -O (syntax.TsUsrOwn, "file exists and is owned by the effective user id") and -G (syntax.TsGrpOwn, "file exists and is owned by the effective group id") tests, for non-Windows only....

A little nitpick ... The [shfmt man page](https://github.com/mvdan/sh/blob/68b762e/cmd/shfmt/shfmt.1.scd) states > If any EditorConfig files are found, they will be used to apply formatting options. If any parser or printer flags...

This PR contains commits that allow `mvdan.cc/sh/v3` to be built using Tinygo. The commit messages will contain more information.

`shfmt` will change some simple one-line subshell expressions into multi lines, which is unnecessary for me: ```diff $ shfmt -d /tmp/a.sh diff /tmp/a.sh.orig /tmp/a.sh --- /tmp/a.sh.orig +++ /tmp/a.sh @@ -1,8...

The file is: ``` #!/usr/bin/env bash if [[ true ]]; then echo 1 # leading with 4 spaces fi ``` And shfmt will change the leading spaces to tab: ![image](https://github.com/user-attachments/assets/4bb2e33c-7a02-404f-a1f6-ff5fd23f2fbf)...

I had a named pipe in my source directory, and `shfmt .` suddenly stopped working. It probably doesn't make sense to try reading non-regular files.