Reputation: 2283
How do I use the result of a command from the terminal?
e.g. lets say I use locate to find the path of a file.
locate -br ^filename.c$
can I write something like:
vim (locate -br ^filename.c$)
to directly open the file with vim?
Upvotes: 0
Views: 83
Reputation: 70223
It's called command substitution:
vim $(locate -br ^filename.c$)
Older syntax, less recognizable and thus not encouraged:
vim `locate -br ^filename.c$`
Upvotes: 3