2016-07-22 190 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