It didn't work unfortunately. The array was not past over to the shell script.
I'm changing methods. The
perl script calls the shell script without parameters now. It writes to a file, and the shell script reads from it. The problem now is that only one line can be read even though there are more than one line in the file, or nothing can be read. I have tried a few different ways to do it, one of them follows (it didn't read at all). I have created a file with a few lines in, and the script works fine, but it won't read more than one line if the file was generated by the
perl script. Thanks!
#!/bin/bash
FILE="/home/.../somefile"
textArray[0]="" # hold text
c=0 # counter
# read whole file in loop
while read line
do
textArray[$c]=$line # store line
c=$(expr $c + 1) # increase counter by 1
done < $FILE
# get length of array
len=$(expr $c - 1 )
# use for loop to reverse the array
for (( i=0;i<$len; i++));
do
echo "make is work: ${textArray[$i]}"
done