Take the 2-minute tour ×

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
add comment

1 Answer

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
add comment

Your Answer


