Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

help with understanding array

Status
Not open for further replies.

grazinggoat

Programmer
Mar 12, 2008
41
0
0
US
Can someone explain why the array is being put back in itself?
I don't understand why this needs to happen FILE_ARRAY[ $(( IDX )) ]="${FILE_ARRAY[ $(( IDX )) ]} ${FILE}"


Code:
                set -A FILE_ARRAY
                (( IDX = 0 )) ; (( COUNT = 0 ))
                for FILE in ${FILES} ; do
                        (( COUNT += 1 ))
                        FILE_ARRAY[ $(( IDX )) ]="${FILE_ARRAY[ $(( IDX )) ]} ${FILE}"
                        (( COUNT % 100 == 0 )) && (( IDX += 1 ))
                done
 

It is concatenating array + space + ${file}...in a loop.

----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
PS: It's concatenating in groups of 100 files.
[pipe]

----------------------------------------------------------------------------
The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top