#!/bin/sh
b=( a b c d )
count=1
for a in ${b[@]}; do
example_$count=$a # how do I declare this variable "example_$count"
echo example_$count; # and how do I echo it
(( count++ ))
done
我需要的是这样的:
$example_1=a
$example_2=b
$example_3=c
$example_4=d