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'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}