@rdrtx1
I changed the permissions and got it run but it produces the incorrect output, if it finds one file it prints one newline, if two files are found it prints two newlines etc. Also I fail to see where you are taking the individual files and putting them into an array.
@bipinajith
I tried something like this earlier and it did not work either. When I do this is does not split up my string either. Array index one still prints out the full string, I do not see where this splits the string up either.
@radoulov
I do not fully understand your code because I am very new to bash, I just need to know exactly how to split a string from find into an array.
Quote:
If you tell us what you actually need to do,
we could give a more appropriate solution.
What I am trying to do:
-find files older than 31 days from multiple directories
-store those multiple files into an array based on which directory they are from
-iterate through those arrays and ask the user if there are any files they want to keep
-deleted all the files that the user does not want kept
I am stuck on the 2nd step though, if my
find result produces one hit, everything works fine, but if more than one item is found, then both of those items are stored as one index. I have tried many options and the closest I have come is storing one of the files as array index one, but array index two remains empty, leaving out the other files.
I do not understand how to split a string at whitespace and then get it into an array.
Is there a pipe I could use for this?