You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
#!/bin/bash
|
|
|
|
system=$(cat /etc/os-release | sed -n 3p)
|
|
|
|
if [[ $system == *"arch"* ]]
|
|
then
|
|
ip=$(ip -json route get 8.8.8.8 | jq -r '.[].prefsrc')
|
|
elif [[ $system == *"debian"* ]]
|
|
then
|
|
ip=$(hostname -I | awk '{print $1}')
|
|
fi
|
|
|
|
echo $ip
|
|
|