Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- FILENAME=test.txt
- MSG=$((ls $FILENAME) 2>&1);
- ret=$?
- re="name=(.*)"
- if [ $ret -ne 0 ]; then
- # 文件没有找到
- echo $MSG >> err.log
- echo "Error message written in err.log"
- else
- # 找到了文件
- echo "File found:Starting Process"
- for line in `cat $FILENAME`; do
- if [[ $line =~ $re ]]; then
- echo ${BASH_REMATCH[1]} >> stdout.log;
- fi
- done
- fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement