Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Possible Duplicate:
How to replace a command with the result of another in linux?

I'm able to parse my command output so it only shows the file name that I'm interested.

My question is, I want to be able to take the output and use it as a parameter for svn diff.

svn diff /filename_from_output/
share|improve this question

marked as duplicate by DragonLord, slhck, iglvzx, Simon Sheehan, Dennis Jul 15 '12 at 4:46

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

set the filename from output to a variable and pass that variable in to your command. foo = some command; some_other_command $foo; –  Scott Wilson Apr 17 '12 at 19:09

2 Answers 2

up vote 6 down vote accepted

Normally, the following should work:

svn diff "$(your-command)"

$() is simple bash command substitution. The output of the command enclosed in $() will be substituted in the outer command.

share|improve this answer

I usually enclose the command in backquotes. This works in tcsh too... I am just used to doing it this way because I write a bit of Perl.

svn diff `whatname.sh`

Or if the output can contain spaces:

svn diff "`whatname.sh`"
share|improve this answer

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