欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久

打開(kāi)APP
userphoto
未登錄

開(kāi)通VIP,暢享免費電子書(shū)等14項超值服

開(kāi)通VIP
批量創(chuàng )建和刪除文件腳本
批量創(chuàng )建文件腳本
腳本功能:在/bash/test/log下生成2010年1至12月份名為 Trans_Debug_日期.log文件,每次執行只能生成一個(gè)月份的log文件.不能一次生成多個(gè)月份的log文件
#/bin/bash
a=/bash/test/log
     if [ -n "$1" ];then
           if [ $1 -eq 1 ] || [ $1 -eq 3 ] || [ $1 -eq 5 ] || [ $1 -eq 7 ] || [ $1 -eq 8 ];then
                           echo "正在創(chuàng )建${1}月份日志文件....!";sleep 2
                       for (( i = 0; i <= 9; i++ ))
                           do
                              touch ${a}/Trans_Debug_20100${1}0$i.log
                              touch ${a}/Trans_Debug_20100${1}1$i.log
                              touch ${a}/Trans_Debug_20100${1}2$i.log
                       for (( x = 0; x <= 1; x++ ))
                           do
                              touch ${a}/Trans_Debug_20100${1}3$x.log
                              rm -rf ${a}/Trans_Debug_20100${1}00.log
                         done
                         done
                              ls -l ${a}/Trans_Debug_20100${1}* | awk '{ print $9}'
                       fi

     if [ $1 -eq 2 ]; then
             echo "正在創(chuàng )建${1}月份日志文件....!";sleep 2
          for (( i = 0; i <= 9; i++ ))
              do
                 touch ${a}/Trans_Debug_20100${1}0$i.log
                 touch ${a}/Trans_Debug_20100${1}1$i.log
                 touch ${a}/Trans_Debug_20100${1}2$i.log
                 rm -rf ${a}/Trans_Debug_20100${1}00.log
                 rm -rf ${a}/Trans_Debug_20100${1}29.log
            done
                 ls -l ${a}/Trans_Debug_20100${1}* | awk '{ print $9}'
         fi

     if [ $1 -eq 4 ] || [ $1 -eq 6 ] || [ $1 -eq 9 ]; then
              echo "正在創(chuàng )建${1}月份日志文件....!";sleep 2
          for (( i = 0; i <= 9; i++ ))
              do
                 touch ${a}/Trans_Debug_20100${1}0$i.log
                 touch ${a}/Trans_Debug_20100${1}1$i.log
                 touch ${a}/Trans_Debug_20100${1}2$i.log
           for (( x = 0; x <= 0; x++ ))
               do
                 touch ${a}/Trans_Debug_20100${1}3$x.log
                 rm -rf ${a}/Trans_Debug_20100${1}00.log
             done
             done
                 ls -l ${a}/Trans_Debug_20100${1}* | awk '{ print $9}'
              fi

      if [ $1 -eq 11 ]; then
                echo "正在創(chuàng )建${1}月份日志文件....!";sleep 2
              for (( i = 0; i <= 9; i++ ))
                   do
                      touch ${a}/Trans_Debug_2010${1}0$i.log
                      touch ${a}/Trans_Debug_2010${1}1$i.log
                      touch ${a}/Trans_Debug_2010${1}2$i.log
                for (( x = 0; x <= 0; x++ ))
                    do
                       touch ${a}/Trans_Debug_2010${1}3$x.log
                       rm -rf ${a}/Trans_Debug_2010${1}00.log
                   done
                   done
                       ls -l ${a}/Trans_Debug_2010${1}* | awk '{ print $9}'
                  fi                    
     if [ $1 -eq 10 ] || [ $1 -eq 12 ]; then
              echo "正在創(chuàng )建${1}月份日志文件....!";sleep 2
            for (( i = 0; i <= 9; i++ ))
                do
                   touch ${a}/Trans_Debug_2010${1}0$i.log
                   touch ${a}/Trans_Debug_2010${1}1$i.log
                   touch ${a}/Trans_Debug_2010${1}2$i.log
             for (( x = 0; x <= 1; x++ ))
                 do
                    touch ${a}/Trans_Debug_2010${1}3$x.log
                    rm -rf ${a}/Trans_Debug_2010${1}00.log
               done
               done
                    ls -l ${a}/Trans_Debug_2010${1}* | awk '{ print $9}'
               fi
         else
                   echo "invalid command!"
               fi

批量刪除文件腳本
腳本功能:該腳本主要以月份為參數來(lái)刪除創(chuàng )建文件腳本下生成的log文件,一次可刪除多個(gè)月份的log文件.
#/bin/bash
clear
log_file=/bash/test/log
  if [ -n "$1" ];then
       echo "==========file delete=============="
  if [ $1 -le 9 ];then
          for (( i = 1; i <= $1; i++ ))
               do
                 ls -l $log_file/Trans_Debug_20100${i}*
                 rm -f $log_file/Trans_Debug_20100${i}*
            done
         fi
  if [ $1 -gt 9 ];then
          for (( i = 1; i <= 9; i++ ))
               do
                 ls -l $log_file/Trans_Debug_20100${i}*
                 rm -f $log_file/Trans_Debug_20100${i}*               
           for (( x = 10; x <= $1; x++ ))
               do
                  ls -l $log_file/Trans_Debug_2010${x}*
                  rm -f $log_file/Trans_Debug_2010${x}*
             done    
       done
             fi
     else
          echo "Command failed ERR!"
   fi
測試創(chuàng )建文件腳本
[root@localhost test]# ./mk_file.sh 3
正在創(chuàng )建3月份日志文件....!
/bash/test/log/Trans_Debug_20100301.log
/bash/test/log/Trans_Debug_20100302.log
/bash/test/log/Trans_Debug_20100303.log
/bash/test/log/Trans_Debug_20100304.log
/bash/test/log/Trans_Debug_20100305.log
/bash/test/log/Trans_Debug_20100306.log
/bash/test/log/Trans_Debug_20100307.log
/bash/test/log/Trans_Debug_20100308.log
/bash/test/log/Trans_Debug_20100309.log
/bash/test/log/Trans_Debug_20100310.log
/bash/test/log/Trans_Debug_20100311.log
/bash/test/log/Trans_Debug_20100312.log
/bash/test/log/Trans_Debug_20100313.log
/bash/test/log/Trans_Debug_20100314.log
/bash/test/log/Trans_Debug_20100315.log
/bash/test/log/Trans_Debug_20100316.log
/bash/test/log/Trans_Debug_20100317.log
/bash/test/log/Trans_Debug_20100318.log
/bash/test/log/Trans_Debug_20100319.log
/bash/test/log/Trans_Debug_20100320.log
/bash/test/log/Trans_Debug_20100321.log
/bash/test/log/Trans_Debug_20100322.log
/bash/test/log/Trans_Debug_20100323.log
/bash/test/log/Trans_Debug_20100324.log
/bash/test/log/Trans_Debug_20100325.log
/bash/test/log/Trans_Debug_20100326.log
/bash/test/log/Trans_Debug_20100327.log
/bash/test/log/Trans_Debug_20100328.log
/bash/test/log/Trans_Debug_20100329.log
/bash/test/log/Trans_Debug_20100330.log
/bash/test/log/Trans_Debug_20100331.log
[root@localhost test]# ls log/
Trans_Debug_20100301.log  Trans_Debug_20100308.log  Trans_Debug_20100315.log  Trans_Debug_20100322.log  Trans_Debug_20100329.log
Trans_Debug_20100302.log  Trans_Debug_20100309.log  Trans_Debug_20100316.log  Trans_Debug_20100323.log  Trans_Debug_20100330.log
Trans_Debug_20100303.log  Trans_Debug_20100310.log  Trans_Debug_20100317.log  Trans_Debug_20100324.log  Trans_Debug_20100331.log
Trans_Debug_20100304.log  Trans_Debug_20100311.log  Trans_Debug_20100318.log  Trans_Debug_20100325.log
Trans_Debug_20100305.log  Trans_Debug_20100312.log  Trans_Debug_20100319.log  Trans_Debug_20100326.log
Trans_Debug_20100306.log  Trans_Debug_20100313.log  Trans_Debug_20100320.log  Trans_Debug_20100327.log
Trans_Debug_20100307.log  Trans_Debug_20100314.log  Trans_Debug_20100321.log  Trans_Debug_20100328.log
 
測試刪除文件腳本
[root@localhost test]# ./rm_log.sh 3
==========file delete==============
ls: /bash/test/log/Trans_Debug_201001*: 沒(méi)有那個(gè)文件或目錄
ls: /bash/test/log/Trans_Debug_201002*: 沒(méi)有那個(gè)文件或目錄
-rw-r--r--  1 root root 0  5月 13 20:09 /bash/test/log/Trans_Debug_20100301.log
-rw-r--r--  1 root root 0  5月 13 20:09 /bash/test/log/Trans_Debug_20100302.log
-rw-r--r--  1 root root 0  5月 13 20:09 /bash/test/log/Trans_Debug_20100303.log
-rw-r--r--  1 root root 0  5月 13 20:09 /bash/test/log/Trans_Debug_20100304.log
-rw-r--r--  1 root root 0  5月 13 20:09 /bash/test/log/Trans_Debug_20100305.log
-rw-r--r--  1 root root 0  5月 13 20:09 /bash/test/log/Trans_Debug_20100306.log
-rw-r--r--  1 root root 0  5月 13 20:09 /bash/test/log/Trans_Debug_20100307.log
-rw-r--r--  1 root root 0  5月 13 20:09 /bash/test/log/Trans_Debug_20100308.log
-rw-r--r--  1 root root 0  5月 13 20:09 /bash/test/log/Trans_Debug_20100309.log
-rw-r--r--  1 root root 0  5月 13 20:09 /bash/test/log/Trans_Debug_20100310.log
-rw-r--r--  1 root root 0  5月 13 20:09 /bash/test/log/Trans_Debug_20100311.log
-rw-r--r--  1 root root 0  5月 13 20:09 /bash/test/log/Trans_Debug_20100312.log
-rw-r--r--  1 root root 0  5月 13 20:09 /bash/test/log/Trans_Debug_20100313.log
-rw-r--r--  1 root root 0  5月 13 20:09 /bash/test/log/Trans_Debug_20100314.log
-rw-r--r--  1 root root 0  5月 13 20:09 /bash/test/log/Trans_Debug_20100315.log
-rw-r--r--  1 root root 0  5月 13 20:09 /bash/test/log/Trans_Debug_20100316.log
-rw-r--r--  1 root root 0  5月 13 20:09 /bash/test/log/Trans_Debug_20100317.log
-rw-r--r--  1 root root 0  5月 13 20:09 /bash/test/log/Trans_Debug_20100318.log
-rw-r--r--  1 root root 0  5月 13 20:09 /bash/test/log/Trans_Debug_20100319.log
-rw-r--r--  1 root root 0  5月 13 20:09 /bash/test/log/Trans_Debug_20100320.log
-rw-r--r--  1 root root 0  5月 13 20:09 /bash/test/log/Trans_Debug_20100321.log
-rw-r--r--  1 root root 0  5月 13 20:09 /bash/test/log/Trans_Debug_20100322.log
-rw-r--r--  1 root root 0  5月 13 20:09 /bash/test/log/Trans_Debug_20100323.log
-rw-r--r--  1 root root 0  5月 13 20:09 /bash/test/log/Trans_Debug_20100324.log
-rw-r--r--  1 root root 0  5月 13 20:09 /bash/test/log/Trans_Debug_20100325.log
-rw-r--r--  1 root root 0  5月 13 20:09 /bash/test/log/Trans_Debug_20100326.log
-rw-r--r--  1 root root 0  5月 13 20:09 /bash/test/log/Trans_Debug_20100327.log
-rw-r--r--  1 root root 0  5月 13 20:09 /bash/test/log/Trans_Debug_20100328.log
-rw-r--r--  1 root root 0  5月 13 20:09 /bash/test/log/Trans_Debug_20100329.log
-rw-r--r--  1 root root 0  5月 13 20:09 /bash/test/log/Trans_Debug_20100330.log
-rw-r--r--  1 root root 0  5月 13 20:09 /bash/test/log/Trans_Debug_20100331.log
[root@localhost test]# ls log/
[root@localhost test]#
本站僅提供存儲服務(wù),所有內容均由用戶(hù)發(fā)布,如發(fā)現有害或侵權內容,請點(diǎn)擊舉報。
打開(kāi)APP,閱讀全文并永久保存 查看更多類(lèi)似文章
猜你喜歡
類(lèi)似文章
linux rm 自定義回收站功能
find命令中的print0和xargs
linux之ls目錄處理命令
touch 命令
每天一個(gè)linux命令(20):find命令之exec
linux登錄后出現-bash-4.1$,解決辦法以及造成這樣的原因
更多類(lèi)似文章 >>
生活服務(wù)
分享 收藏 導長(cháng)圖 關(guān)注 下載文章
綁定賬號成功
后續可登錄賬號暢享VIP特權!
如果VIP功能使用有故障,
可點(diǎn)擊這里聯(lián)系客服!

聯(lián)系客服

欧美性猛交XXXX免费看蜜桃,成人网18免费韩国,亚洲国产成人精品区综合,欧美日韩一区二区三区高清不卡,亚洲综合一区二区精品久久