linux中shell脚本实现下载完关机

用mint 有一段时间了,下载基本用firefox,有时下载几个G的游戏。可是firefox没有找到下载完关机的选择。处于这个原因,写了这个。

download_shutdown.sh

#!/bin/bash
# Created By:   Demo <demo@demo.com>
# Created Time:  2015-01-30 12:36:44
# Modified Time:  2015-01-30 12:54:21
dir=$1
while [ "1" ]
do
  if [ ! -d "$1" -a -x "$1" ];then
    echo 'please specify a directory'
  fi
   
  ret=`find $1 -ctime -4 |sort | wc | awk -F ' ' '{print $1}'`
  if [ "$ret" -ge "2" ];then
    #echo 'h'
    sleep 240 
  else
    init 0
  fi
done

以上所述就是本文的全部内容了,希望大家能够喜欢。