SHARE
TWEET

Untitled

a guest Oct 13th, 2019 72 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. FILENAME=test.txt
  2. MSG=$((ls $FILENAME) 2>&1);
  3. ret=$?
  4. re="name=(.*)"
  5.  
  6. if [ $ret -ne 0 ]; then
  7.     # 文件没有找到
  8.     echo $MSG >> err.log
  9.     echo "Error message written in err.log"
  10. else
  11.     # 找到了文件
  12.     echo "File found:Starting Process"
  13.     for line in `cat $FILENAME`; do
  14.       if [[ $line =~ $re ]]; then
  15.         echo ${BASH_REMATCH[1]} >> stdout.log;
  16.       fi
  17.     done
  18. fi
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top