sh
sh copied to clipboard
how to leave one-line subshells as they are
shfmt
will change some simple one-line subshell expressions into multi lines, which is unnecessary for me:
$ shfmt -d /tmp/a.sh
diff /tmp/a.sh.orig /tmp/a.sh
--- /tmp/a.sh.orig
+++ /tmp/a.sh
@@ -1,8 +1,11 @@
#!/usr/bin/env bash
# vim:set et sw=4 ts=4:
-CURDIR=$(cd `dirname $0`; pwd)
+CURDIR=$(
+ cd $(dirname $0)
+ pwd
+)
Could you please add a configuration option like keep_oneline_subshell = true
, or simply provide a comment tag like # @shfmt-ignore
?