码迷,mamicode.com
首页 > 系统相关 > 详细

shell 脚本之 shell 练习题汇总

时间:2016-12-22 20:30:36      阅读:197      评论:0      收藏:0      [点我收藏+]

标签:define   pre   shel   使用   习题   elf   color   记录   span   

整理了一些 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. 

shell 脚本之 shell 练习题汇总

标签:define   pre   shel   使用   习题   elf   color   记录   span   

原文地址:http://www.cnblogs.com/liwei0526vip/p/6212289.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!