侧边栏壁纸
博主头像
落叶人生博主等级

走进秋风,寻找秋天的落叶

  • 累计撰写 130562 篇文章
  • 累计创建 28 个标签
  • 累计收到 9 条评论
标签搜索

目 录CONTENT

文章目录

shell 函数编程知识

2023-11-06 星期一 / 0 评论 / 0 点赞 / 42 阅读 / 555 字

#!/bin/bash dir=`pwd` cd $dir function checkfile(){ if [ -f "yang.txt" ] then echo "file is exstis"

#!/bin/bash
dir=`pwd`
cd $dir
function checkfile(){
if [ -f "yang.txt" ]
then
echo "file is exstis"
else
echo "file not find"
touch yang.txt
fi
}
function checktime(){
files=`find ./ -mtime +3|wc -l`
if [ $files -gt 0 ]
then
echo "I will delete files"
rm -rf $files
else
echo "there is not find some deletefiles"
fi
}
case $1 in
ckf)
checkfile;;
ckt)
checktime;;
*)
echo "Usage:{$0 $1 ckf||ckt }"
esac

广告 广告

评论区