如何最好地处理数组中混合的文件和目录。我需要创建一个文件和文件夹数组,并循环遍历数组,并将数组中的每个项目置于带有 -rf 选项的 rm 命令中:
#Build array of files to be deleted
FILES=(
"~/Library/Preferences/Adobe InDesign"
"~/Library/Caches/Adobe InDesign"
"~/Library/Saved Application State/com.adobe.InDesign.savedstate"
)
#Loop through array deleting each file/directory with the recursive force options
for i in "${FILES[@]}"
do
rm -rf "$i"
done
exit