'How to convert the IPv4 fetching command to shell script

I was working on the shells part, but got stuck in between to get the equivalent code to get the IPv4 address of the system.

for /f "tokens=14" %%a in ('ipconfig ^| findstr IPv4') do set _IPaddr=%%a


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source