Updated the shell command execution function.