Question

Is there a way how to combine this two commands into the one in a console ?


Run 1st command and use vi for the output from the first command as oneliner.


1.

bundle show activerecord

#=> /home/jusepe/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-3.2.14

2.

vi /home/jusepe/.rbenv/versions/2.0.0-p247/lib/ruby/gems/2.0.0/gems/activerecord-3.2.14`
Was it helpful?

Solution

Option 1: Using a subshell

This is the easiest solution

vi $(bundle show activerecord) 

Or

vi `bundle show activerecord`

Option 2: Using xargs

This is the slightly more 'bashy' way of doing things but for such a simple case, its probably overkill.

bundle show activerecord | xargs vim
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top