From 7cc256727cbdad50b08a13a1268853f7aeedddac Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sun, 16 Apr 2017 06:58:29 +0300 Subject: str_join: echo instead of printf --- %HOME%/.bash_utils/text.sh | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/%HOME%/.bash_utils/text.sh b/%HOME%/.bash_utils/text.sh index 238eb5e..db87066 100644 --- a/%HOME%/.bash_utils/text.sh +++ b/%HOME%/.bash_utils/text.sh @@ -254,20 +254,14 @@ str_join() ( local delim="$1" shift - case "$#" in - 0) - ;; - 1) - echo "$@" - ;; - *) - local s="$1" - shift - printf -- '%s' "$s" - - for s; do - printf -- '%s%s' "$delim" "$s" - done - ;; - esac + [ "$#" -eq 0 ] && return 0 + + local str="$1" + shift + + echo -n "$str" + for str; do + echo -n "$delim$str" + done + echo ) -- cgit v1.2.3