-1

What would be the correct way to do the following:

$ ls -t | head -n1 | vim -

Currently, this will read the 'filename' into vim, but I'm looking at actual open that filename that's passed to it as a string. How would this be done?

Without opening the file we get:

$ ls -t | head -n1
2020-11-05.txt
Rubén
  • 34,714
  • 9
  • 70
  • 166
samuelbrody1249
  • 4,379
  • 1
  • 15
  • 58

1 Answers1

0

You can pass it like this:

$ vim "$(ls -t | head -n1)"
samuelbrody1249
  • 4,379
  • 1
  • 15
  • 58