Capturing info in an array is not working
I found this code
Code:
#! /bin/bash However the code is not working for me. Anytime I try to echo one of the array entries it doesn't display anything. Is this code to old to work? It doesn't seem that old. I run the code in the terminal like this: Code:
i=1; ls | while read line;do array[$i]="$line"; (( i++ )); done This line works: Code:
ls | while read line;do echo "$line"; done I am thinking maybe just the array part of the code is wrong. |
Nevermind. I found the answer.
Code:
i=1 |
All times are GMT -5. The time now is 01:55 AM. |