I'd also like to point out the "-1" option for "ls", my most common usage is: ls -ltr to show most recent files at the bottom of the listing (oldest first), long-style listing... but if I do need to do something with just the filename(s), I'd use something like this instead: ls -1tr|tail -n 1
As for nifty usages, you can also have fun with back-ticks, like this: for i in `ls -1`; do echo filename is $i; done but of course substituting various options in on ls, can include a grep inside the backticks, and of course do more useful things than echo.... ciao, Ben On Tue, Mar 4, 2008 at 5:50 PM, Fred James <[EMAIL PROTECTED]> wrote: > Rob Hudson wrote: > > >Of course... how could I forget head and tail?! > > > >Thanks. > > > >On 3/4/08, Hal Pomeranz <[EMAIL PROTECTED]> wrote: > > > > > >>ls -t | head -1 > >> > >> > Rob Hudson > Will that do it for you, or do you need something to exclude/include any > particular type(s) of file(s)? > Regards > Fred James > > > > _______________________________________________ > EUGLUG mailing list > [email protected] > http://www.euglug.org/mailman/listinfo/euglug > _______________________________________________ EUGLUG mailing list [email protected] http://www.euglug.org/mailman/listinfo/euglug
