#!/bin/bash

if [ -f str.txt ]   ## 如果str.txt存在,则返回true
then
   strval=$(cat str.txt|awk '{printf "%s",$1}'|sed 's/ //g')    ## 使用awk去除换行,使用sed去除空格
   if [ "" == "$strval" ]     ## 判断文件是否为空
   then echo "empty"
   elif [ "all" == "$strval" ]  ## 判断文件的内容是否为all
    then echo "backup all"
   else echo "backup part"
   fi
else
  echo "str.txt not exist"
fi

 

相关文章:

  • 2021-07-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-21
  • 2022-12-23
  • 2021-11-21
  • 2022-02-04
  • 2021-07-03
  • 2021-10-05
相关资源
相似解决方案