Reputation: 1
I use windows 10 and WSL2. To run linux applications on the X server hosted by the windows machine, I use the second command: export WSL_HOST_IP=$( cmd.exe /C netsh interface ip show addresses "vEthernet (WSL)" | grep "IP Address" | sed -e "s/\sIP Address:\s//g" ) and it works:
echo $WSL_HOST_IP 172.20.48.1
how do i transform it into the DISPLAY variable? what I want to get is this: DISPLAY = $WSL_HOST_IP:0.0 but I can't write ": 0.0" in bash. Anyone help me? Thanks in advance
Upvotes: 0
Views: 1020
Reputation: 26452
You need to remove DOS line ending with s/\r//
:
export WSL_HOST_IP=$( cmd.exe /C netsh interface ip show addresses "vEthernet (WSL)" | grep "IP Address" | sed -e "s/\sIP Address:\s//g; s/\r//" )
Upvotes: 1