bash - find oldest file from list -


i've file list of files in different directories , want find oldest one. feels should easy shell scripting don't know how approach this. i'm sure it's easy in perl , other scripting languages i'd know if i've missed obvious bash solution.

example of contents of source file:

/home/user2/file1   /home/user14/tmp/file3   /home/user9/documents/file9 

#!/bin/sh  while ifs= read -r file;     [ "${file}" -ot "${oldest=$file}" ] && oldest=${file} done < filelist.txt  echo "the oldest file '${oldest}'" 

Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -