Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
/usr/bin/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 1

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
2  
@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

 
discard

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.