3

This seems like it should be easy enough to do, but I'm clearly not understanding something fundamental about piping output back and forth.

I'm trying to do something like this:

bundle show some-gem-name | pushd

Where the result puts me in the path of the gem name with popd functionality supported to get back where I was.

TCopple
  • 133
  • 2

1 Answers1

4

pushd expects the directory as a command line argument, not as standard input so you cannot pipe the directory to it. Try

pushd "`bundle show some-gem-name`"

instead.

Kyle Jones
  • 15,015
  • 5
    Alternative: pushd "$(bundle show some-gem-name)" - works identical, but could be easier to type depending on the keyboard layout. $(...) can be used nested. – jofel Mar 26 '12 at 15:52
  • 1
    @jofel The difference is more than that. See http://unix.stackexchange.com/q/5778/9382 – rozcietrzewiacz Mar 26 '12 at 17:09
  • 1
    @rozcietrzewiacz Actually in this case there is no difference. backticks and $(…) only differ when there are backslashes or backticks inside. – Gilles 'SO- stop being evil' Mar 26 '12 at 22:54
  • @Gilles OK, thanks for pointing that out. To make it clear: I referred to jofel's comment on ease of typing - which shouldn't be seen as the only difference in general (when someone reads this slightly out of context). – rozcietrzewiacz Mar 26 '12 at 23:16