I'm using find to generate a list of old backups, compressed tars, into a file, then reading that file into while loop. I out put the list to a log and screen, both looking correct.
echo $x works fine; /vol4/backups/forms_02_24_2024.tar.gz
But "rm $x" doesn't work, because it's receiving changed line below;
rm: cannot remove '(arr+=(/vol4/backups/forms_02_24_2024.tar.gz))' :No such file or directory
arr()
while read line; do
x="(arr+=("$line"))"
echo $x
rm $x
done < ./old_backups.txt
Tried using cut and sed to modify the line, but I still didn't get what rm needed, which is simply the path to each old file. But rm is still no getting the correct file names.
xis just a string, not an array, so the+=is only a literal, not adding anything. Why can't you justrm $line?(arr+=(/vol4/backups/forms_02_24_2024.tar.gz)). Do you not realize that is from the third line of your program? Why do you even have aarr()array since yo¨don't use it? Justrm "$line".findsupport-delete?readarrayinstead of a loop to populate an array with the lines of a file)echocommand you post here, does not fit the error message from thermcommand. I don't believe that you posted this information correctly. Provide a screenshot of what happens when you run your script.