|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now! |
|
#1
|
|||
|
|||
|
Selecting only newest file
Hello,
I was hoping someone could help me out. I am trying to figure out how to search for the newest file in a directory and save it as a variable. For example, if you do a 'ls -ltr', the last file listed would be the newest file. Does anyone know how to save just that file name in a variable? Thanks, Krypto |
|
#2
|
||||
|
||||
|
in bash/ksh/sh:
foo=`ls -tr | tail -1` echo $foo
__________________
Up the Irons What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home. "Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest Down with Sharon Osbourne Puzzle of the Month solved by sizeablegrin, etienne141 and L7Sqr, superior C/C++ programmers of the month |
|
#3
|
|||
|
|||
|
Works great!! Thanks!
|
![]() |
| Viewing: Dev Shed Forums > Operating Systems > UNIX Help > Selecting only newest file |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|