source dirstack
dirstack uses the most recently used directory file that is considered "current". Current directory files are those directory files in the ~/.sessions directory that do not have the .save suffix. After using a current directory file, dirstack will rename the directory file so that it has the .save suffix.
The source'ing shell's starting directory is removed from the final stack of directories. This is done because dirstack is intended to mirror the list of directories it is reading, not to add to the existing directory stack.
This script should be sourced, rather than executed. Directory names that contain spaces are properly handled.
csh has a facility for saving a directory stack, but it is geared towards single-shell use. This script is intended for use in a windowing environment.
set ttyname = `xprop -id $WINDOWID WM_NAME | awk -F\" '{print $2}' | awk '{print $1}'`
alias dv "dirs -v | perl -p -e 's/^\d+\s+//'"
alias pd "pushd \!* ; dv > $dirsfile"
Copyright 2014 Wayne Morrison
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.