popd [-n] [+N | -N]
Remove entries from the directory stack.
Removes entries from the directory stack. With no arguments, removes the top directory from the stack, and changes to the new top directory.
Options:
-n- Suppresses the normal change of directory when removing directories from the stack, so only the stack is manipulated.
Arguments:
+N- Removes the Nth entry counting from the left of the list shown bydirs, starting with zero. For example:popd +0removes the first directory,popd +1the second.-N- Removes the Nth entry counting from the right of the list shown bydirs, starting with zero. For example:popd -0removes the last directory,popd -1the next to last.
Exit Status: Returns success unless an invalid argument is supplied or the directory change fails.
Reference: https://www.gnu.org/software/bash/manual/html_node/Directory-Stack-Builtins.html