如何在每个用户的/home
目录中循环并删除文件夹?这将是一个名为/home/$user/.quarentine
的常见词。
答案 0 :(得分:1)
单行:
for user in $(ls /home); do rm -Rf /home/${user}/.quarentine; done
答案 1 :(得分:0)
像这样:
#!/bin/bash
#Get the list of users
USERS=`ls -l /home|grep "^d"|awk '{print $NF}'`
#Loop for each user and delete the files
for i in $USERS
do
rm -rf /home/$i/.quarentine
done