将下面一段程序保存为:rm_tg.sh,并修改它的执行权限:chmod +x rm_tg.sh,然后执行:./rm_tg.sh
就可以删除当前目录下.c文件对应的可执行文件
#!/bin/sh
# 删除当前目录下.c对应的可执行文件
# 文件逐行处理
# 文件逐行处理
# 获取.c文件对应的可执行文件
ls | grep .c | sed -e 's/.c//g' > temp_file
# 逐行处理,判断文件是否存在
cat temp_file | while read line;do
# 存在则删除文件
if test -f $line;then
echo "rm $line"
rm -f $line
else
echo "no $line"
fi
done
ls | grep .c | sed -e 's/.c//g' > temp_file
# 逐行处理,判断文件是否存在
cat temp_file | while read line;do
# 存在则删除文件
if test -f $line;then
echo "rm $line"
rm -f $line
else
echo "no $line"
fi
done
<script>window._bd_share_config={"common":{"bdsnskey":{},"bdtext":"","bdmini":"2","bdminilist":false,"bdpic":"","bdstyle":"0","bdsize":"16"},"share":{}};with(document)0[(getelementsbytagname('head')[0]||body).appendchild(createelement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new date()/36e5)];</script>
阅读(905) | 评论(0) | 转发(0) |
相关热门文章
给主人留下些什么吧!~~
评论热议
本文提供了一个Shell脚本示例,用于删除当前目录下.c文件对应的可执行文件。脚本通过一系列命令操作实现目标,包括获取.c文件、检查是否存在对应可执行文件并进行删除。

被折叠的 条评论
为什么被折叠?



