Created
September 25, 2019 08:09
-
-
Save risyomei/f27179832fd8e81159ef66d1f13390de to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment