Advertisement
Guest User

Untitled

a guest
Oct 13th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement