Quantcast
Channel: How to pass the output of one command as the command-line argument to another? - Unix & Linux Stack Exchange
Browsing latest articles
Browse All 7 View Live

Answer by SethG for How to pass the output of one command as the command-line...

It seems you could use a combination of the answers here. I'm guessing you are wanting to replace space chars with their escaped ascii values in the url. To do this, you need to replace them with...

View Article



Answer by Bruce Ediger for How to pass the output of one command as the...

You could use "xargs". A trivial example: ls -1 *.c | sort -n | xargs cat You would have to take care that xargs doesn't split its stdin into two or more invocations of the comman ("cat" in the example...

View Article

Answer by Michael Mrozek for How to pass the output of one command as the...

You can use backticks (`) to evaluate a command and substitute in the command's output, like: echo "Number of files in this directory: `ls | wc -l`" In your case: wget `echo...

View Article

Answer by wag for How to pass the output of one command as the command-line...

wget also accepts stdin with the - switch. If you want to save the output in a file, use the -O switch. echo http://maps.google.be/maps?saddr\=$1\&daddr\=$2 | sed 's/ /%/g' | wget -i- -O temp.html

View Article

Answer by OneOfOne for How to pass the output of one command as the...

you're not actually executing your url line : #!/bin/sh url="$(echo http://maps.google.be/maps?saddr\=$1\&daddr\=$2 | sed 's/ /%/g')" wget $url

View Article


How to pass the output of one command as the command-line argument to another?

So I have a script that, when I give it two addresses, will search two HTML links: echo "http://maps.google.be/maps?saddr\=$1\&daddr\=$2" | sed 's/ /%/g' I want to send this to wget and then save...

View Article

Answer by Ria Sharma for How to pass the output of one command as the...

xargs is the best option to place output from a command into the argument of other commmand.Suppose the output of command1 is 3 and you want your next command to take this 3 as an argument so you want...

View Article
Browsing latest articles
Browse All 7 View Live




Latest Images