Action (or execution in this case) always speaks louder, so let's look at what this script does when executed (excuse the liberty taken to make the output more verbose):
while read -r line
do
if [ "${line#*'Caused by'}" != "$line" ]; then
echo "Line contains string Caused by"
else
echo "Line does not contain string Caused by"
fi
done
Input: String with Caused by
Output: Line contains string Caused by
Input: Just a normal string
Output: Line does not contain string Caused by
The pattern matching used in this script `"${line#*'Caused by'}` is replacing all string (owing to the wildcard `*`) from the beginning to the end of **_Caused by_** in the inputted line and then it compares it with the original `$line` parameter to see whether they are equal or not. Simple stated, all it does is a check whether the line contains the string _Caused by_. Finally it prints _Line contains string Caused by_ if the line does contain _Caused by_.
Now, a few words about the shell parameter expansion for the `${parameter#word}` format with some examples:
> If the pattern matches the beginning of the value of parameter, then the result of the expansion is the expanded value of parameter with the shortest matching pattern (the "#'' case) or the longest matching pattern (the "##'' case) deleted.
$ test=aabbcc
$ echo ${test#*bb}
$ cc
$ test=aabbcc
$ echo ${test#a*b}
$ bcc
An example of the longest matching pattern format:
$ test=aabbcc
$ echo ${test##a*b}
$ cc
**Reference:** `man bash`: `${parameter#word}`