Commit 10b57ec7 authored by Emeric Verschuur's avatar Emeric Verschuur

Improve join_by to support multi character separator

parent ae332945
...@@ -387,9 +387,12 @@ bashopts_math_min() { ...@@ -387,9 +387,12 @@ bashopts_math_min() {
# join array element # join array element
bashopts_join_by() { bashopts_join_by() {
local IFS="$1" local sep="$1"
shift || bashopts_log C "Usage: bashopts_join_by <character> [elt1 [elt2...]]" shift || bashopts_log C "Usage: bashopts_join_by <separator> [elt1 [elt2...]]"
echo "$*" printf "%s" "$1"
test $# -gt 1 || return 0
shift
printf "$sep%s" "$@"
} }
# dump an option value by its name # dump an option value by its name
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment