You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
because 1) even with the semicolons, it's shorter, 2) usually with variables with tput, it's not so important that each (tput) command warrants its own line and IMO having them on the same line is more intuitive to suggest the string it's styling is wrapped by styling, kind of like printf '---%s---' "word ". Even better shfmt splits only when the existing line is >80 chars and don't format when it's <=80 chars.
Are there any options that take into account of width of line like >80 chars?
shfmt formats cat > "$prof_path <<EOF to cat >"$prof_path <<EOF but the space after > makes it easier to read. In Bash, why is the convention to remove the space as in >/dev/null that I often see preferable to > /dev/null?
Similarly, is it possible to enforce 1 space in arrays e.g. prefer arr=( "itema" "itemb" ) instead of removing the space arr=("itema" "itemb") ?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Is it possible to prevent semicolon from splitting lines? I have:
bin="$(tput bold; tput setaf 2)${0##*/}$(tput sgr0)"
which I find is preferable to the
shfmt
ed:because 1) even with the semicolons, it's shorter, 2) usually with variables with tput, it's not so important that each (tput) command warrants its own line and IMO having them on the same line is more intuitive to suggest the string it's styling is wrapped by styling, kind of like
printf '---%s---' "word "
. Even bettershfmt
splits only when the existing line is >80 chars and don't format when it's <=80 chars.Are there any options that take into account of width of line like >80 chars?
shfmt
formatscat > "$prof_path <<EOF
tocat >"$prof_path <<EOF
but the space after>
makes it easier to read. In Bash, why is the convention to remove the space as in>/dev/null
that I often see preferable to> /dev/null
?Similarly, is it possible to enforce 1 space in arrays e.g. prefer
arr=( "itema" "itemb" )
instead of removing the spacearr=("itema" "itemb")
?Much appreciated.
Beta Was this translation helpful? Give feedback.
All reactions