On 14/01/2021 16.44, William Park wrote:
> Then, I just use variable "rev" and that would be equivalent to
> ${@:55:10}.
So you could just do: rev=(${template[@]:55:10})
With a little function like this, you could call:
Struct template date 7 dev 16 ver 32 rev 10
and get what you want with an existing array 'template'.
Struct(){
local template=$1 n=0
shift
while (($2>0))
do eval "$1=(\${$template[@]:$n:$2})"
((n+=$2))
shift 2
done
}
Cheers,
Peter
