New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unexpected reformatting of multi-line commands #1045
Comments
In the description above $ shfmt -ln bash -i 4 < <(printf '%s\\\n %s\n' "printf '%s\n'" 'My string')
printf '%s\n' \
My string
$ shfmt -ln bash -i 4 < <(printf '%s \\\n %s\n' "printf '%s\n'" 'My string')
printf '%s\n' \
My string Maybe someone can shed some light on this. It might well be that I am missing something here. 🤔 1Sorry for the process substitution brain-gymnastic, it is definitely not something I would use in a real script, but it was the most compact way to offer something to play with in a terminal. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A bash command split on multiple lines without a space before
\
gets reformatted.I am not sure whether this is an expected behaviour, but I was surely surprised by this. I also did not find an answer in existing issues or discussions.
To give some context, I read about the (many) discussions asking for having a maximum length option (e.g. #80). In projects where there is a maximum line length enforcement, we split lines by hand using
\
and I'd likeshfmt
not to change that, especially because then lines would often exceed the maximum length.Is this behaviour intended?
The text was updated successfully, but these errors were encountered: