请教两个简单的脚本编程
1、怎样编写一个shell,该shell用以扫描登录用户的默认目录,对所有以“.a”为后缀的文件合并到用户默认目录下“total.a”文件中,并删除原来的文件?2、编写一个shell,对指定目录,检查其中文件属性是否为777,如发现则提示该文件有危险的属性,并改为754。
谢谢~~ :) 各位高手,谁知道的请告诉一下嘛,救救命啊. 1.
#!/bin/sh
for file in `find $HOME -name "*.a"`; do
cat $file >>$HOME/total.a
rm -f $file
done
2.
#!/bin/sh
for file in `ls $1`; do
ls -l $1/$file | egrep '^-rwxrwxrwx' >/dev/null 2>&1
if [ $? -eq 0 ]; then
echo "$1/$file: file attribute 777!"
chmod 754 $1/$file
fi
done sparks好手段呀! 谢谢,谢谢.请问sparks,我可以加你QQ吗?
因为我想请你吃饭,以表达你的救命之恩. 救人一命,胜造十级浮屠
谢谢你给我这个机会啊! 呵呵
页:
[1]