Re: Beginner's?? Question
On Sunday 21 November 2004 23:51, debian-user-digest-request@lists.debian.org
wrote:
> > David Baron wrote:
> > > Quick answer: How might one retrieve the path to the most recent entry
> > > in a directory to pass to something else in a bash script?
> >
> > kspecial@xzziroz:/tmp$ echo $OLDPWD
> > /home/kspecial
> > kspecial@xzziroz:/tmp$ echo $PWD
> > /tmp
> > kspecial@xzziroz:/tmp$
> >
> > PWD contains the current directory while OLDPWD contains the last
> > accessed directory.
> >
> > --K-sPecial
>
> Just maybe you could use
> $ cd -
>
> It worked for me
All this gets me the current or previously accessed directory.
I am trying to get the most recent file in a known directory. There are
several log-type files in this directory, maybe several from today. I want to
use the last-most recently altered file's name in a script.
Reply to: