One shell script 100 cases

Today started learning to write shell scripts 100 cases, write a blog primarily to record this process for future review, today began the first script:
1, generates a file every day
Description: Follow this date format (xxxx-xx- xx) generates a daily file, for example, today's generation of file) 2017-07-05.log, and the use of disk writes to the file, (regardless of cron, you can just write a script)
[root @ --7-30-the CentOS. 1 the LAMP scripts] everydaydisk.sh CAT #
! # / bin / the bash
D = date +%F
logfile = $ d.log
[-d / Data / the shell / log] || mkdir / Data / the shell / log - the p-
file_path = '/ the Data / shell / log /' $ logfile
df -h> $ file_path
summary: this is mainly investigated two commands: the date of the order date disk command df -h; the other is a conditional test usage.

Guess you like

Origin blog.51cto.com/9447803/2403626