[news.newusers.questions] pushing and popping directories

broadman@ramones.rutgers.edu (Allen Broadman) (02/10/90)

Now that I know just enough about UNIX to start searching through the
directory structure on my machine, I was wondering if there's a way to
pop and push directories in order to save a lot of typing time. And
further, if the directories could be stacked to a preset limit, depth
of n, for instance?
-- 
------
Allen Broadman
broadman@paul.rutgers.edu

euatdt@euas17c10.ericsson.se (Torsten Lif) (02/12/90)

In article <Feb.9.12.31.38.1990.1533@ramones.rutgers.edu> broadman@ramones.rutgers.edu (Allen Broadman) writes:
>
>Now that I know just enough about UNIX to start searching through the
>directory structure on my machine, I was wondering if there's a way to
>pop and push directories in order to save a lot of typing time.

As a matter of fact, yes. Most "civilized" dialects of *NIX support "pushd"
and "popd". "dirs" lets you look at the stack. Try "man" for either of these
three to see their options. (On some versions *NIX you'll find the three of
them in the list of "built-in commands".)

If you find it tricky to hop back and forth in the "man" pages (your version
of "more" may not even support moving backwards in the text and you probably
haven't discovered "less"), I suggest printing out the entire document to
have it easily available for future references. "man pushd | lpr" should
do the trick anywhere. "lpr -P<preferred printer>" might be necessary.

>And
>further, if the directories could be stacked to a preset limit, depth
>of n, for instance?

A quick look in "man" indicates that the stack size in *bytes* can be pre-set.
Presumably, this is to allow the shell to reserve storage space. If what you
desire is a limit of n *items*, at least the dialect we're running doesn't
support that.

/Torsten

 Torsten Lif (formerly Dahlkvist)
 ELLEMTEL Telecommunication Laboratories
 P.O. Box 1505, S-125 25  ALVSJO, SWEDEN
 Tel: +46 8 727 3788