Leo_Gutierrez
Hi.
How can I separate this string:
Code: Select all
"Leonardo"
Code: Select all
L
e
o
n
a
r
d
o
like this
Code: Select all
array[0]=L
array[1]=e
array[2]=o
...
----------------------------
#2 03 May 2009 07:26
Leo_Gutierrez
I found the solution:
Code: Select all
#!/usr/bin/bash
name="Leonardo"
longitud=`expr length "$name"`
for i in $(seq 0 $longitud);
do
echo ${name:$i:1}
done
Code: Select all
leo@lein:~/Escritorio/bash$ bash shell.sh
L
e
o
n
a
r
d
o
leo@lein:~/Escritorio/bash$