Originally Posted by
Lorin Ricker
...and, just for the heck of it, I want it to print it this way:
Code:
~/dir3
~/dir2
~/dir1
~
Code:
foo$ pushd /etc
/etc ~/foo
etc$ pushd /tmp
/tmp /etc ~/foo
tmp$ help dirs
dirs: dirs [-clpv] [+N] [-N]
Display the list of currently remembered directories. Directories
find their way onto the list with the `pushd' command; you can get
back up through the list with the `popd' command.
The -l flag specifies that `dirs' should not print shorthand versions
of directories which are relative to your home directory. This means
that `~/bin' might be displayed as `/homes/bfox/bin'. The -v flag
causes `dirs' to print the directory stack with one entry per line,
prepending the directory name with its position in the stack. The -p
flag does the same thing, but the stack position is not prepended.
The -c flag clears the directory stack by deleting all of the elements.
+N displays the Nth entry counting from the left of the list shown by
dirs when invoked without options, starting with zero.
-N displays the Nth entry counting from the right of the list shown by
dirs when invoked without options, starting with zero.
tmp$ dirs -p
/tmp
/etc
~/foo
tmp$ dirs | tr ' ' '\n'
/tmp
/etc
~/foo
tmp$
HTH
Bookmarks