So I'm trying to get the filenames in a directory read into an array over ssh. The way I'm currently doing it is as follows:
Code:
set -A file_array $(ssh example@42.42.42.42 ls /home/example/directory)
typeset -L14 filename
typeset -i idx=0
typeset -i total=0
total=$(ssh example@42.42.42.42 ls /home/example/directory | wc -l)-1
while [[ $idx -le $total ]]
do
filename=${file_array[$idx]}
done
So the question isn't why this doesn't work, but why it does. Everything makes relative sense to me, other than the -L14 flag in line two. I did some googling (though admittedly it wasn't extensive) and wasn't able to dig anything up on it. Can anyone help me out?
Also if there are ways I can make this more efficient or more reusable, I'd love to hear it.
Thanks.