If the grep command finds a pattern within the specified file, grep returns an exit status of 0, which means success. If the pattern is not found, the exit status returned is 1. The grep program can get its input from a standard input or a pipe, as well as from files.