diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2017-04-16 06:58:29 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2017-04-16 06:58:29 +0300 |
commit | 7cc256727cbdad50b08a13a1268853f7aeedddac (patch) | |
tree | 18ce0136b853c0b9ff8dc3f444420ca10e8f9e4a /%HOME%/.bash_utils | |
parent | str_split: bugfix (diff) | |
download | linux-home-7cc256727cbdad50b08a13a1268853f7aeedddac.tar.gz linux-home-7cc256727cbdad50b08a13a1268853f7aeedddac.zip |
str_join: echo instead of printf
Diffstat (limited to '%HOME%/.bash_utils')
-rw-r--r-- | %HOME%/.bash_utils/text.sh | 26 |
1 files 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 ) |