 Today, we're going to be looking at how to retrieve standard output that's piped to your Script so for example if I did if config that gives me information about my network card I can pipe that into grep And I can grep for I'm just gonna be 192 So there there's an example. That's piped to grep. How do you retrieve that information? It's basically taking everything that's the output of this command and putting it into the next program So if that next program is your script, how do you retrieve that information? Let's go ahead I'm gonna use Vim as my text editor I'm gonna call my script main dot sh and I'm gonna put in my shebang line saying this is a bash script And it's very simple. I do cat dash and that's saying If I now make my script executable It's clear the screen and IIF Config and I pipe that into dot slash my script It's going to basically output the the output of IF config because it's taking that putting that in my script in my script saying Display that information. So what we can do now Like we can have a message before that we can say echo Welcome and now we'll say Welcome and Give the IF config output. We can also now take that and pipe it into grep 192 And if we do that now it says welcome and it gives us that line that we grabbed again if we go in here We can also Then add into that awk and I can say Print dollar sign to which is saying print the second column and that should give us our IP address So welcome and your IP address if we want we can put that into a variable now for use in our script So I can say IP equals and then in dollar sign Parentheses I can get that now IP was the output of what was piped into this script grept and printed here and now I can say echo Your IP address is dollar sign IP Now I run that and it will say welcome your IP address is and your IP address obviously This is just an example, you know, not every IP address is gonna start with 192 Much as an example of taking the output because if I run that without Piping I've configured you just get welcome and then it just kind of hangs there because it's waiting for input Which I can give it control see it does it's just you don't actually I'm just curious real quick Control D. Okay. Yeah control D. We'll get you out of that anyway That is how you can retrieve information that is piped From one program into your script, which is useful in many cases. So again To get what is pipe the basic part of this tutorial is this cat dash That will that whatever that is will be what's piped into your script And then you can manipulate that however you want throw it into variables and use those variables later on So that is it. I hope that you do find this useful I hope that you check out my website films by Chris calm That's Chris the K. There is a link in the description of the video And as always I hope that you have a great day support me on patreon. Thank you