I guess the typical way would be: ERR=$(popd 2>&1) However, the command cannot run in a sub-shell as it would have no effect in the current shell. Is writing to a file the only way ? -- rahul