![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
shell
wtxy24
其实我是只猫
展开
-
shell 删除文件,如果文件不存在,提示不存在
删除文件,如果文件不存在,提示不存在#!/bin/bashecho"enter file name you intend to delete: \c"readfilenameif[ -f $filename ]then rm -i $filenameelse echo "the file $filename does notexist!" exit 1原创 2016-02-21 10:31:55 · 5939 阅读 · 0 评论 -
shell 修改文件的用户权限,如果文件不存在,提示不存在
修改文件的用户权限,如果文件不存在,提示不存在#!/bin/bashecho"enter file name"readfilenameif[ -f $filename ]then chmod u+x $filenameelse echo "the file $filename does notexist!" exit 1fi原创 2016-02-21 10:32:57 · 701 阅读 · 0 评论 -
文件测试运算符
文件测试运算符文件测试运算符用于检测 linux 文件的各种属性 -d file 检测是否是目录,如果是。返回true : [ -b $file ] 返回true-f file 检测是否是文件,如果是。返回true-r file 检测文件是否可读,如果是,返回true-w file 检测文件是否可写,如果是,返回true-x file 检测文件是否可执行,如果原创 2016-02-22 09:00:01 · 789 阅读 · 0 评论 -
linux 给joe jane Julie 发送邮件
给joe jane Julie 发送邮件(redhat)#!/bin/bashfor NAME in joe jane juliedo ADDRESS="$NAME@example.com" MESSAGE="project are due today" echo $MESSAGE |mail -s Reminder $ADDRESSdone翻译 2016-02-23 08:43:28 · 372 阅读 · 0 评论 -
Shell 传递参数
Shell 传递参数注意,$10 不能获取第十个参数,获取第十个参数需要${10}。当n>=10时,需要使用${n}来获取参数。参数处理说明$#传递到脚本的参数个数$*以一个单字符串显示所有向脚本传递的参数$$脚本运行的当前进程ID号$!后台运行的最后一个进程原创 2016-02-24 09:05:17 · 323 阅读 · 0 评论