Pass output of one command to argument of other
22 Jul 2014Well Linux is famous for combining things in power full ways in which anything is possible from a command line. The real fun of Linux came when you start focusing on terminal to do everything...
It's possible to pipeline commands in terminal. Also it's possible to pass output of something as an argument of other.
For example you can ping to your own external ip by
ping $(curl -s curlmyip.com)
curl curlmyip.com returns you ip address. This address is passed to the telnet as an argument. Whatever you put between $( and ) will execute as if it is a bash command.
It's possible to pipeline commands in terminal. Also it's possible to pass output of something as an argument of other.
For example you can ping to your own external ip by
ping $(curl -s curlmyip.com)
curl curlmyip.com returns you ip address. This address is passed to the telnet as an argument. Whatever you put between $( and ) will execute as if it is a bash command.