"Each time a dir/.. match is found, variable expansion with
substitution is used to remove the matched part of the path.
"Regular expressions were introduced in bash 3.0. Bash 3.2
changed regular expression handling slightly in that quotes around
regular expressions became part of the regular expression. So, if
you have a version of bash (with regular expression support) and
the code doesn't work, put the regular expression in the while loop
Some of the products that appear on this site are from companies from which QuinStreet receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. QuinStreet does not include all companies or all types of products available in the marketplace.