Dirstack is a shell script that creates a list of unique directories from the history file in chronological order.
The cd-functions, which I have developed to navigate easily through directories from within the commandline, depend heavily upon dirstack.
In this video I analyze how the dirstack variable is been build.
https://tilvids.com/w/bWz2X7KG3MzE2aWZAggMHU