linux

# 这里的例子每天作为循环,并展示当天的前一天
#!/bin/bash

startDate=20160201
endDate=20160328
startSec=`date -d "$startDate" "+%s"`
endSec=`date -d "$endDate" "+%s"`
for((i=$startSec;i<=$endSec;i+=86400))
do
    current_day=`date -d "@$i" "+%Y%m%d"`
    one_day_ago=`date -d "$current_day yesterday" +%Y%m%d`
    echo "current_day:${current_day}, yesterday:${one_day_ago}"
done

停止指定程序

$ps -ef | grep firefox | grep -v grep | cut -c 9-15 | xargs kill -s 9  

原文地址:https://www.cnblogs.com/zhangyanhe/p/9212449.html