I've got a script that I run continually to monitor vsftpd logs. Here is a small example:#!/bin/shtail -n0 -F /var/log/vsftpd.log | while read line; do    if echo $line | grep -q 'OK UPLOAD:'; then        username=$(echo $line | cut -d  -f9 | sed 's/\[\(.*\)\]/\1/')        if [ $? -ne 0 ]; then            echo ERROR: Failure to get parse username. Line it is trying to parse: $line >>/var/log/ftpmonitor.log            # We need to remove the file with any error so it doesn't linger            rm -rf $home$filenamewithpath            if [ $? -ne 0 ]; then                echo ERROR: Failed to delete video file >>/var/log/ftpmonitor.log                exit 1            fi            exit 1        fi     # lot of other stuff here...     fidoneI want to catch any errors I can with any command failure and stop. Originally I thought I'd use exit to stop. Normally that makes sense but in this case this script needs to keeping running all the time monitoring the vsftpd logs. So I don't want to exit the script I want to just stop any other commands after that failure. How can I achieve this?
stop processing in shell script but don't exit
shell;shell script
I'm assuming you mean you want to skip to the next line of /var/log/vsftpd.log?If so, just use continue.#!/bin/shtail -n0 -F /var/log/vsftpd.log | while read line; do    if echo $line | grep -q 'OK UPLOAD:'; then        username=$(echo $line | cut -d  -f9 | sed 's/\[\(.*\)\]/\1/')        if [ $? -ne 0 ]; then            echo ERROR: Failure to get parse username. Line it is trying to parse: $line >>/var/log/ftpmonitor.log            # We need to remove the file with any error so it doesn't linger            rm -rf $home$filenamewithpath            if [ $? -ne 0 ]; then                echo ERROR: Failed to delete video file >>/var/log/ftpmonitor.log                continue            fi            continue        fi     # lot of other stuff here...     fidonecontinue simply skips to the next iteration of the enclosing loop.