On bash, I have the following (typical) scenario:
~/some/dir$ find | grep java
which outputs, for example
./subdir1/subdir2/file1.java
./subdir1/subdir3/file2.java
./subdir1/subdir4/file3.java
./subdir1/subdir2/file4.java
./subdir1/subdir6/file5.java
now I know that file5.java
, which is the file I was looking for (for example), is on that subdir, so I execute:
vi subdir1/subdir6/file5.java
but in order to do this I have to either type the path (I know that using the TAB key speeds it up) or copy and paste the path to the file
the question is: is there a shortcut/variable on bash (or any other shell) that references the lines outputted by the previous command, so that I can say
vi [whatever the previous command returned on the 5th line]
, and that would be a nice time saver
thanks!