If separator is a single character, then shell can split a string or
join arguments.  But, if separator is string, then it gets messy.  We
shouldn't have to resort to Awk/Python for that.

How about Python-like string split and string join?

${parameter...} is overloaded as is, and we are running out of special
characters.  So, how about, just appending at the end of parameter
expansion syntax?  
    ${parameter...;sep}
where 
    ${parameter...} is already existing expansion, and
    sep is substring to join, if ${parameter...} is multiple argument
        syntax involving '*', like ${*}, ${*:10:10}, ${array[*]:20}, and
    sep is substring to split on, if ${parameter...} is single string
        syntax like ${var}, ${var:3:10}, ${1}, ${10:2:4}

Eg.
    array=( "${var;.}" )
would be equivalent to
    IFS=. read -a array <<< "$var"
    
Eg.
    echo "${*;.}"
would be equivalent to
    (IFS=.; echo "$*")

Where it would be used?
    - everywhere

Advantage?
    - replaces multiple lines in shell function
    - makes Bash script simpler and clearer
    - less bookkeeping and less mistakes

-- 
William Park <opengeome...@yahoo.ca>

Reply via email to