pdf.sh

来自「该shell可以每15秒检测当前目录是否创建或删除了.pdf或.PDF的文件」· Shell 代码 · 共 49 行

SH
49
字号
#!/bin/shwhile [  1 ]dols>infile1sleep 15ls>infile2flag=1flag2=0for i in  ` comm -23 infile2 infile1`do  if  [ "${i##*.}" = "pdf" ] || [ "${i##*.}" = "PDF" ]   then     flag=$(($flag-1))    if [ "$flag" -eq 0 ]      then        flag2=$(($flag2+1))        echo "The flowing pdf file(s) have been created in the last 15 seconds:"     fi          echo $i   fidonefor i in  ` comm -23 infile1 infile2`do  if  [ "${i##*.}" = "pdf" ] || [ "${i##*.}" = "PDF" ]   then     flag=$(($flag-2))    if [ "$flag" -eq -1 ] || [ "$flag" -eq -2 ]      then        flag2=$(($flag2-2))        echo "The flowing pdf file(s) have been deleted in the last 15 seconds:"     fi                                                                                                     echo $i   fidoneif [ "$flag2" -eq 0 ] ; then  echo "No pdf files have been created or removed in the last 15 seconds" fi#case "$flag2" in#1 && #fidone

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?