Hi Richard, Richard Retanubun wrote: > /bin/dash -c "pgrep -f /usr/sbin/atftpd"; echo $? > -vs- > /bin/bash -c "pgrep -f /usr/sbin/atftpd"; echo $? > > The dash version returns the PID of the grep itself and thus always succeeds. > The bash version works as expected. As the pgrep(1) manual explains, the running pgrep or pkill process will never report itself as a match. However, when running pgrep through dash, it reports the process id of the shell executing pgrep, while the bash version and recent dash versions optimize "sh -c 'single command'" to sh -c 'exec pgrep -f /usr/sbin/atftpd' so there is no shell process left to report. If that "exec" is specified explicitly, the result is the same in both shells. Hope that helps, Jonathan -- To unsubscribe from this list: send the line "unsubscribe dash" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html