Mise à jour de 'ecoleA/update.sh'

test du user ROOT
This commit is contained in:
Cédric Abonnel 2022-12-12 13:57:02 +01:00
parent a1294339a3
commit 0afdc39c27
1 changed files with 7 additions and 0 deletions

View File

@ -1,4 +1,11 @@
#!/bin/bash
# Test du user ROOT
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
# Suppression des kernels non utilisé
echo -e "\n [INFO] Kernel installé mais plus utilisé"
dpkg --list 'linux-image*' | grep ^ii | awk '{print $2}' | sort | egrep "[0-9]-generic" | head -n 3 | tr '\n' ' ' > list-kernel