LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How to pipe output to another command parameter? (https://www.linuxquestions.org/questions/linux-newbie-8/how-to-pipe-output-to-another-command-parameter-741382/)

FireRaven 07-20-2009 07:23 AM

How to pipe output to another command parameter?
 
Hi,

How do I render the output of one command to another.

Example, calling a webservice to login:
# wget localhost/login.php --post-string="userid=1&password=SECRET1"

But now I want to change 'SECRET1' to output from another program like...
# echo "SECRET2" | wget localhost/login.php --post-string="userid=1&password=SECRET1"

Where I am trying to now call the webservice form the 'echo' commands output which is 'SECRET2' and not 'SECRET1'.

Guttorm 07-20-2009 07:32 AM

Maybe:

wget localhost/login.php --post-string="userid=1&password=$(echo SECRET2)"

FireRaven 07-20-2009 07:44 AM

Works perfect, thanks!


All times are GMT -5. The time now is 10:43 PM.