Created
June 2, 2023 12:32
-
-
Save TheFlash2k/f08ca214b902c7fe07797be3516acd3b to your computer and use it in GitHub Desktop.
Lists local IP of an interface
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [[ $# != 1 ]]; then | |
echo "No interface specified!" | |
exit 1 | |
fi | |
ip a s $1 | grep inet | cut -d $'\n' -f 1 | cut -d ' ' -f 6 | cut -d '/' -f 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment