Pour les experts des scripts j'aimerais que vous corrigiez mon scripts si nécessaire

#!/bin/bash
# mise_a_jour_automatique
# Le fichier majauto doit se trouver dans le dossier /etc/cron.daily
# de manière à ce que tous les jours une actualisation du système se fasse automatiquement
# Utilisez gedit depuis un terminal en mode administrateur
# Faire ce qui suit :
# gedit /etc/cron.daily/majauto && chmod +x /etc/cron.daily/majauto
# puis faites un copier/coller du texte présent dans gedit et quittez gedit

# Augmenter la priorité du script
/usr/bin/renice +20 -p $$ >/dev/null 2>&1

# Stopper le service graphique en fonction du bureau pour que tout se passe en mode terminal
# sous GNOME ET Xfce
if [ “$(env|grep -i current_desktop|cut -f2 -d'=')” = “GNOME” ] || [ “$(env|grep -i current_desktop|cut -f2 -d'=')” = “Xfce” ]; then
/usr/sbin/service gdm stop
wait $!
elif [ “$(env|grep -i current_desktop|cut -f2 -d'=')” = “Unity” ]; then
# Sur Unity :
/usr/sbin/service lightdm stop
wait $!
fi

# Vérification de l'installation du paquet apt-fast
if [ “$(/usr/bin/dpkg –get-selections apt-fast|/bin/grep -o install)” != “install” ]; then
/bin/echo -e “\r”| /usr/bin/add-apt-repository ppa:apt-fast/stable
wait $!
/usr/bin/apt-get -yqq update
wait $!
/usr/bin/apt-get -y install axel apt-fast
wait $!
fi

# Vérification du fichier /etc/hosts
if [ “`/bin/grep '127.0.0.1' /etc/hosts`” = “`/bin/echo -e “127.0.0.1\\tlocalhost”`” ]; then
/bin/sed -i 's/127.0.0.1\tlocalhost/127.0.0.1\tlocalhost '“`/bin/hostname`”'/' /etc/hosts
fi

# Actualisation des identités USB
/usr/sbin/update-usbids
wait $!

# Actualisation des identifiants PCI
/usr/bin/update-pciids
wait $!

# Actualisation du support langage
/usr/sbin/apt-fast -yqq install $(/usr/bin/check-language-support -l fr)
wait $!

# La variable Rebootage prends la valeur de la commande
Rebootage=$(/usr/bin/apt-get -s dist-upgrade|/bin/grep -m 1 -o linux|/bin/grep -m 1 -o linux)
wait $!

# Avant d'entamer une actualisation :
# Tente de réparer le contrôle d'intégrité si cela est utile
/usr/bin/apt-get -fyqq install
wait $!

# Actualisation de la lecture des listes de paquets
/usr/sbin/apt-fast -qq -y update
wait $!

# Actualisation de la distribution
/usr/sbin/apt-fast -qq -y dist-upgrade
wait $!

# Suppression du cache local des fichiers inutiles
/usr/sbin/apt-fast -qq -y autoclean
wait $!

# Suppression du cache local de tous les fichiers téléchargés
/usr/sbin/apt-fast -qq -y clean
wait $!

# Suppression de tous les paquets inutiles installés automatiquement
/usr/bin/apt-get -yqq autoremove
wait $!

# Enlever les noyaux surnuméraires
numeroanterieur=$(/bin/echo $(/bin/uname -r|/usr/bin/cut -f2 -d-)-1|bc)
partieun=$(/bin/uname -r|/usr/bin/cut -f1 -d-)
partiedeux=$(/bin/uname -r|/usr/bin/cut -f3- -d-)
anciennumero=$(/bin/echo $partieun-$numeroanterieur-$partiedeux|/usr/bin/cut -d“-” -f-2)
noyauactuel=$(/bin/uname -r | /usr/bin/cut -d“-” -f-2)
/usr/sbin/apt-fast -y purge $(dpkg –get-selections linux-headers-[0-9]* linux-image-[0-9]* | /usr/bin/awk '{print $1}' | /bin/grep -v $noyauactuel| /bin/grep -v $anciennumero)
wait $!

# Si la variable Rebootage est égale à linux alors reboot
if [ “$Rebootage” = “linux” ]; then /sbin/reboot; fi

wait $(pidof majauto)
wait $$

# Relancer le service graphique
# Sur GNOME et Xfce :
if [ “$(env|grep -i current_desktop|cut -f2 -d'=')” = “GNOME” ] || [ “$(env|grep -i current_desktop|cut -f2 -d'=')” = “Xfce” ]; then
/usr/sbin/service gdm start
wait $!
elif [ “$(env|grep -i current_desktop|cut -f2 -d'=')” = “Unity” ]; then
# Sur Unity :
/usr/sbin/service lightdm start
wait $!
fi