Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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

Suppose you are in following situation:

<command 1>
<output of command 1>
<want to use output of command 1 here without have to retype it>

My specific case:

which eclipse
ldd /usr/bin/eclipe

But I would prefer not to have to type this last line out, is there any shortcut?

share|improve this question
up vote 6 down vote accepted

Use $():

ldd "$(which eclipse)"
share|improve this answer
Or backticks: ldd `which eclipse` – Blair Dec 18 '11 at 3:17
@Blair: $() is preferred over backticks, because it's nestable. Thus, it's good to form the habit of using $(), even when they aren't strictly necessary. – Scott Severance Dec 18 '11 at 5:01
@ScottSeverance: Thanks, I'd never considered that. I'll have to try and change my habits :). – Blair Dec 18 '11 at 5:03

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.