Updated bash example to avoid forking subshell.