Lo script mi serve per eliminare, quando lo eseguo, i kernel vecchi.
La versione però vorrei poterla specificare come argomento.

Es.
codice:
./kernel_cleaner.sh --ver=2.6.22 --rel=r8
Intanto ho scritto questo.
codice:
#!/bin/sh

ROOT_UID=0
E_SAMEVERSION=66
E_UNKNOWNVERSION=67
E_NOTROOT=68

if [ "$UID" -ne "$ROOT_UID" ]
then
  echo "Must be root to run this script."
  exit $E_NOTROOT
fi

if [ -n "$1" ]
# Test if command line argument is present (non-empty)
then
  VER=$1
  REL=$1
else
  echo "You must specify a version and a release of the kernel in the command line argument."
  echo "In the form \"--ver=n --rel=n\""
  exit $E_UNKNOWNVERSION
fi


if [ 'uname -r' = $VER-gentoo-$REL ]
then
  echo "The version you want to remove is in use."
  exit $E_SAMEVERSION
fi

emerge -C gentoo-sources-$VER-$REL
rm -r /usr/src/linux-$VER-gentoo-$REL
rm -r /lib/modules/$VER-gentoo-$REL
mount /boot
rm /boot/kernel-$VER-$REL
echo "Fatto."
echo "Modifica il file \"/boot/grub/grub.conf\" e rimuovi la/e voce/i riguardante/i il kernel $VER-$REL"
echo "Poi ricordati di dare \"umount /boot\""

exit 0