Add a new function to test network connection.
Display "bonjour" function in zlogin only if a network connection is available
This commit is contained in:
parent
1f499de4ce
commit
c7129b7953
3
zlogin
3
zlogin
|
@ -14,8 +14,11 @@
|
||||||
#echo "\n#### uptime ####"
|
#echo "\n#### uptime ####"
|
||||||
#uptime
|
#uptime
|
||||||
|
|
||||||
|
# If a network connection is available (check function def in zshrc)
|
||||||
|
if ( is_network ); then
|
||||||
# Affiche un dessin (cf fonction définie dans zshrc)
|
# Affiche un dessin (cf fonction définie dans zshrc)
|
||||||
bonjour
|
bonjour
|
||||||
|
fi
|
||||||
|
|
||||||
# Afficher la liste todo (paquet devtodo)
|
# Afficher la liste todo (paquet devtodo)
|
||||||
printf '%b' "${MAGENTA}++++++++++++++++++++++ ${WHITEB}Liste de tâches${RESET} ${MAGENTA}:++++++++++++++++++++++${RESET}\n"
|
printf '%b' "${MAGENTA}++++++++++++++++++++++ ${WHITEB}Liste de tâches${RESET} ${MAGENTA}:++++++++++++++++++++++${RESET}\n"
|
||||||
|
|
13
zshrc
13
zshrc
|
@ -351,6 +351,19 @@ function ippriv()
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Test if a network connection is available
|
||||||
|
function is_network()
|
||||||
|
{
|
||||||
|
for path_interface in $(find /sys/class/net/ ! -name lo -type l);
|
||||||
|
do
|
||||||
|
IS_UP=$(grep 1 ${path_interface}/carrier)
|
||||||
|
if [ ${IS_UP} ]; then
|
||||||
|
return 0
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
printf '%b' "${REDB}Not Online${RESET}\n"
|
||||||
|
return 1
|
||||||
|
}
|
||||||
|
|
||||||
#Renomme les fichiers en minuscule
|
#Renomme les fichiers en minuscule
|
||||||
function lowercase()
|
function lowercase()
|
||||||
|
|
Loading…
Reference in New Issue