Hi,
I put together this wee script to handle the business of pruning old kernels for my GF. It runs on KDE login and nags her if there are more than 2 kernels installed, and automates the removal of the oldest one if she consents.
This worked when I wrote and tested it (less than a month ago IIRC) but I just tried it yesterday and it failed like so:
I assume something must have changed in apt, as that's where the fail apparently took place. Can anyone advise what the problem is, and how I might fix it?
Thanks in advance!
I put together this wee script to handle the business of pruning old kernels for my GF. It runs on KDE login and nags her if there are more than 2 kernels installed, and automates the removal of the oldest one if she consents.
Code:
#!/bin/sh K_MAX=2 K_INST=`ls /boot | grep -c vmlinuz` if [ $K_INST -gt $K_MAX ] ; then K_OLD=`ls /boot | grep -m1 vmlinuz | egrep -o '2\.6\.[0-9\-]+[0-9]'` if kdialog --yesno "You have more than 2 kernels installed. The oldest one is kernel-$K_OLD. Would you like to get rid of it now? This should just take a minute or so."; then K_MV=`echo ${K_OLD} | egrep -o '[0-9]+-[0-9]+'` sudo apt-get remove '.*2\.6\.${K_MV}.*' fi fi
Code:
Reading package lists... Done Building dependency tree Reading state information... Done E: Regex compilation error - Invalid preceding regular expression
Thanks in advance!
Comment