Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- colors=(red blue green black purple yellow)
- idx=0
- echo ${#colors[*]}
- while [ $idx -lt ${#colors[*]} ]
- do
- echo ${colors[$idx]}
- idx=`expr $idx + 1`
- done
- echo
- #print the strings in the array and their lengthes
- for idx in ${!colors[*]}
- do
- echo ${colors[$idx]} ${#colors[$idx]}
- done
- echo
- for item in ${colors[*]}
- do
- echo $item
- done
- echo
- echo ${colors[*]}
- echo
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement