You can check `DIRSTACK` length:
$ [[ ${#DIRSTACK[@]} -gt 1 ]] && echo dir stack non-empty
Note that you can not use this method if `DIRSTACK` is unset.
You can check `DIRSTACK` length:
$ [[ ${#DIRSTACK[@]} -gt 1 ]] && echo dir stack non-empty
Note that you can not use this method if `DIRSTACK` is unset.