i have started to use (better said learn) ksh as a scripting language about a week ago. as i was reading "Learning the Korn Shell (2nd edition)" i have reached at some point the
array part.
so i have tried to make the following simple script.
Code:
# cat array.sh
#!/usr/local/bin/ksh93
K=~/bin
cd $K
KA=$(ls $PRE.*)
print ${#KA[*]}
running the script yields the following output
As far as i have read in the book this should print the total number of array components.
Using the -x feature of ksh i have the following output:
Code:
# ksh93 -x array.sh
+ ls addvpn.sh disk.size.sh ksh.sh s.test.sh array.sh vpn.sh
+ KA=$'addvpn.sh\ndisk.size.sh\nksh.sh\ns.test.sh\nssh.connect.sh\nvpn.sh'
+ print 1
Trying to print an element from the array let's say the first
doesn't work either. The out put is blank.
Code:
# ksh93 -x array.sh
+ ls addvpn.sh disk.size.sh ksh.sh s.test.sh ssh.connect.sh vpn.sh
+ KA=$'addvpn.sh\ndisk.size.sh\nksh.sh\ns.test.sh\nssh.connect.sh\nvpn.sh'
+ print ''
what am i missing here? thanks
all the best,
v