general: Swap echo to printf
This commit is contained in:
parent
81db772a5d
commit
a1044d728f
15
neofetch
15
neofetch
|
@ -3263,19 +3263,10 @@ get_bold() {
|
|||
}
|
||||
|
||||
trim() {
|
||||
# When a string is passed to "echo" all trailing and leading
|
||||
# whitespace is removed and inside the string multiple spaces are
|
||||
# condensed into single spaces.
|
||||
#
|
||||
# The "set -f/+f" is here so that "echo" doesn't cause any expansion
|
||||
# of special characters.
|
||||
#
|
||||
# The whitespace trim doesn't work with multiline strings so we use
|
||||
# "${1//[[:space:]]/ }" to remove newlines before we trim the whitespace.
|
||||
|
||||
set -f
|
||||
# shellcheck disable=2086
|
||||
builtin echo -E ${1//[[:space:]]/ }
|
||||
# shellcheck disable=2048,2086
|
||||
set -- $*
|
||||
printf "%s\\n" "${*//[[:space:]]/ }"
|
||||
set +f
|
||||
}
|
||||
|
||||
|
|
Reference in New Issue