遍历用户文件夹并删除文件夹
Loop through users folders and delete a folder
如何为每个用户遍历 /home
目录并删除文件夹?这将是一个常见的名为 /home/$user/.quarentine
.
像这样:
#!/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
在一行中:
for user in $(ls /home); do rm -Rf /home/${user}/.quarentine; done
如何为每个用户遍历 /home
目录并删除文件夹?这将是一个常见的名为 /home/$user/.quarentine
.
像这样:
#!/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
在一行中:
for user in $(ls /home); do rm -Rf /home/${user}/.quarentine; done