shell 脚本之 shell 练习题汇总

整理了一些 shell 相关的练习题,记录到这里。

1. 请按照这样的日期格式 xxxx-xx-xx 每日生成一个文件,例如:今天生成的文件为 2013-09-23.log, 并且把磁盘的使用情况写到到这个文件中。

1 #!/bin/bash
2 # Date:   2016-12-22
3 # Author: liwei
4 
5 today=$(date +%Y-%m-%d)
6 log_file_name=/var/log/selfdefine/${today}.log
7 /bin/df -lh > $log_file_name

然后再增加一条每日定点执行的任务计划即可

 

2. 

相关文章

系ubuntu 下面打开终端输入:sudo apt-get install sendmail...
依家我有1个软件goagent目录(大家懂得) 放在/home/gateman/...
其实我想讲的是 cp -L关于-L参数的解释:-L, --dereferenc...
原地址:http://www.rjgc.net/control/content/content.php?...
chroot,即 change root directory (更改 root 目录)。在 li...
简单解析下, stdin就是标准输入, stdout就是标准。举个例子...