我对 Linux 和 shell 脚本非常陌生,我被困在我必须编写的脚本的某个部分上。这是课堂作业。
我需要编写一个循环来检查是否有用户(在我的组中)使用 write 开关打开了 public_html 文件rwx
。这样我就可以将信息写入其中,而不是public_html
在我获得所需信息后从该组成员那里检索它。
这就是我现在的位置:
while read temp;do
# this is my main hang up, to see it this global
# switch is turned on to write.
if[[ <9> = 'w' ]]
echo "$temp has their w switch turned on."
# this also is throwing me off, i think this is the way to
# keep going until all the public_html directories in the
# group have been seen.
done < ..public_html
或者我正在试图弄清楚如何使用 find 命令,这在逻辑上似乎更简单,更有意义,我只是从未使用过它,所以我在这方面有点坐不住了,我试过这条线没有有用,也许它接近?
find . */home/public_html -perm -g +w
#I was hoping that would search all user directories looking for the permission +w turned on in public_html.