I am currently setting up a test ARM based board running Linux and I need to access it from a Windows machine. This test board is connected via the com port using a USB-to-Serial cable. I am using PowerShell to run commands and control the test board. I'm stuck at a stage where I need to query the test board to find out its IP Address and store it in a variable on my Windows host.
This is what I'm using to display the IP Address:
$port.WriteLine("ifconfig | grep -A 1 'gphy' | tail -1 | cut -d ':' -f 2 | cut -d ' ' -f 1")
When I read the output from the console, I get the ifconfig command as well as the IP Address into my variable:
$ipAddr = $port.ReadExisting()
$ipAddr
The output is something like:
ifconfig | grep -A 1 'gphy' | tail -1 | cut -d ':' -f 2 | cut -d ' ' -f 1
123.33.33.150
#
I fail to get only the IP Address as a string. Is my approach correct or am I doing something wrong here? What is the best way for querying for the IP Address?
$portdefined/created?