aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2017-04-16 06:58:29 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2017-04-16 06:58:29 +0300
commit7cc256727cbdad50b08a13a1268853f7aeedddac (patch)
tree18ce0136b853c0b9ff8dc3f444420ca10e8f9e4a
parentstr_split: bugfix (diff)
downloadlinux-home-7cc256727cbdad50b08a13a1268853f7aeedddac.tar.gz
linux-home-7cc256727cbdad50b08a13a1268853f7aeedddac.zip
str_join: echo instead of printf
Diffstat (limited to '')
-rw-r--r--%HOME%/.bash_utils/text.sh26
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
)