2016-07-22 191 views

回答

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 
+0

感谢您的回答 – Troz

+0

它不是解析LS的输出是一个好主意(见对方的回答链接)。更好地使用一个简单的循环,就像thirafael那样。 – fedorqui

1

在单行:

for user in $(ls /home); do rm -Rf /home/${user}/.quarentine; done 
+0

这是有用的,谢谢 – Troz

+0

更好的说'用户在/ home/*'。 [解析'ls'的输出是不好的(http://mywiki.wooledge.org/ParsingLs) – fedorqui