I've got about a day of experience in bash as of now..
string () {
for (( i=0; i<${#1}; i++ ))
do
echo "$"${1:$i:1}""
done
}
string "hello"
This script returns "$h
", "$e
", "$l
", "$l
", "$o
",
but I actually want it to return the contents of variables h
, e
, l
, l
and o
.
How do I do that?