0

I can't seem to get the array "args" to retain all elements in the script below. If I uncomment the echo inside the loop I get the results as expected. However, I need the result to use later in the script. Currently, if the array is called outside the loop, it only retains the last element. My theory is it's overwriting the element each pass and I've phrased it incorrectly. Can some please explain how to achieve this. Iv spent several hours fiddling with it.

for (( i=3; i<${#GameSystemShortName[@]}; i++ ));
do
RomCount=$($Pirompredir${GameSystemShortName[$i]}| wc -l)
args=("$RomCount")
#echo "${args[@]}"
done
echo "${args[@]}"
2
  • I will check.. Sorry Commented Aug 9, 2018 at 16:27
  • Alan Birtles is correct. I needed only to see that post and a simple + fixed it. Thankyou Commented Aug 9, 2018 at 16:33

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.