List to data

# Put the values in list into and array called data.
function list_to_data {
    declare ltd_d
    declare -i ltd_idx
    unset data
    ltd_idx=0
    for ltd_d in $@
    do
        data[$ltd_idx]=$ltd_d
        ((ltd_idx++))
    done
    echo ${data[@]}
}

list_to_data a b c d e f
echo ${data[@]}
a b c d e f

Comments

Popular posts from this blog

oche, lik echo but a bit easier to use.

Bithon: Run Python Interactively Inside Bash

Parsing Columns From Files WITHOUT awk