Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 4 down vote accepted

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`"


share|improve this answer
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
@jofel The difference is more than that. See unix.stackexchange.com/q/5778/9382 – rozcietrzewiacz Mar 26 '12 at 17:09
@rozcietrzewiacz Actually in this case there is no difference. backticks and $(…) only differ when there are backslashes or backticks inside. – Gilles 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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.