我编写了一个示例KornShell函数来拆分String,将它放在一个数组中,然后打印出值.代码如下
#!/usr/bin/ksh
splitString() {
    string="abc@hotmail.com;xyz@gmail.com;uvw@yahoo.com"
    oIFS="$IFS"; 
    IFS=';' 
    set -A str $string
    IFS="$oIFS"
}
splitString
echo "strings count = ${#str[@]}"
echo "first : ${str[0]}";
echo "second: ${str[1]}";
echo "third : ${str[2]}";
现在echo不打印出数组的值,所以我假设它与定义的数组的范围有关.
我是Shell脚本的新手,有人可以帮助我理解上面例子中的变量范围吗?