|
Not quite a "Unix" shell, but the [Ammonite Scala Shell](http://ammonite.io/#Ammonite-Shell) lets you do this trivially: lihaoyi Ammonite$ amm
@ import ammonite.ops._
import ammonite.ops._
@ ls! pwd
res1: LsSeq =
".git" 'LICENSE 'ci 'project 'sshd
".gitignore" 'amm 'integration 'readme 'target
".idea" "appveyor.yml" "internals-docs" "readme.md" 'terminal
".travis.yml" "build.sbt" 'ops 'shell
@ ls! pwd | (_.mtime)
res2: Seq[java.nio.file.attribute.FileTime] = List(
2017-06-21T12:24:41Z,
2017-06-11T13:48:45Z,
2017-06-21T12:29:05Z,
2017-06-11T13:48:45Z,
2017-05-01T03:41:14Z,
2017-06-18T14:06:33Z,
2017-06-11T13:48:45Z,
2017-06-18T08:01:20Z,
2017-06-18T12:34:00Z,
2017-06-19T06:05:51Z,
2017-06-18T09:06:07Z,
2017-06-18T14:06:33Z,
2017-06-18T14:06:15Z,
2017-06-18T14:07:20Z,
2017-06-11T13:48:45Z,
2017-06-18T14:06:33Z,
2017-06-18T14:06:33Z,
2017-06-19T06:06:03Z,
2017-06-18T14:06:33Z
)
@ ls! pwd | (_.mtime) sorted
res3: Seq[java.nio.file.attribute.FileTime] = List(
2017-05-01T03:41:14Z,
2017-06-11T13:48:45Z,
2017-06-11T13:48:45Z,
2017-06-11T13:48:45Z,
2017-06-11T13:48:45Z,
2017-06-18T08:01:20Z,
2017-06-18T09:06:07Z,
2017-06-18T12:34:00Z,
2017-06-18T14:06:15Z,
2017-06-18T14:06:33Z,
2017-06-18T14:06:33Z,
2017-06-18T14:06:33Z,
2017-06-18T14:06:33Z,
2017-06-18T14:06:33Z,
2017-06-18T14:07:20Z,
2017-06-19T06:05:51Z,
2017-06-19T06:06:03Z,
2017-06-21T12:24:41Z,
2017-06-21T12:29:05Z
)
@ ls! pwd | (_.mtime) min
res4: java.nio.file.attribute.FileTime = 2017-05-01T03:41:14Z
@ ls! pwd | (_.mtime) max
res5: java.nio.file.attribute.FileTime = 2017-06-21T12:29:05Z
@ ls! pwd maxBy (_.mtime)
res6: Path = root/'Users/'lihaoyi/'Dropbox/'Github/'Ammonite/".idea"
Ammonite certainly has problems around JVM memory usage and startup times, but it has a sweet spot for this sort of not-quite-trivial filesystem operations that are a pain to do in Bash but too small to be worth futzing with a Python script |