diff options
author | Barry Jackson <barjac@mageia.org> | 2023-01-10 12:03:39 +0000 |
---|---|---|
committer | Barry Jackson <barjac@mageia.org> | 2023-01-10 12:03:39 +0000 |
commit | d4441873dc3ee7c404e94ed68e69af107074738d (patch) | |
tree | 5e1d9135ffa05528fe0ce6441cceb073a4636ccd | |
parent | 5a7934bbf32d03d94e667a4807786f46603ebf81 (diff) | |
download | remove-old-kernels-d4441873dc3ee7c404e94ed68e69af107074738d.tar remove-old-kernels-d4441873dc3ee7c404e94ed68e69af107074738d.tar.gz remove-old-kernels-d4441873dc3ee7c404e94ed68e69af107074738d.tar.bz2 remove-old-kernels-d4441873dc3ee7c404e94ed68e69af107074738d.tar.xz remove-old-kernels-d4441873dc3ee7c404e94ed68e69af107074738d.zip |
fix for Q grep issue
-rwxr-xr-x | remove-old-kernels | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/remove-old-kernels b/remove-old-kernels index 79fb601..cb68cd7 100755 --- a/remove-old-kernels +++ b/remove-old-kernels @@ -299,11 +299,11 @@ allkernels=$(rpm -qa --last|grep "kernel-") # Get the kernel version and release required by the installed virtualbox-flavour-latest get_vbox_kern() { if echo "$allkernels"|grep -q "virtualbox-${kernelType}-latest"; then - vb_latest_ver=$(echo "$allkernels"|grep "virtualbox-${kernelType}-latest"|cut -d- -f5-|rev|cut -d. -f2-|rev) + vb_latest_ver=$(echo "$allkernels"|cut -d' ' -f1|grep "virtualbox-${kernelType}-latest"|cut -d- -f5-|rev|cut -d. -f2-|rev) else qavkern=; return fi -depkern=$(echo "$allkernels"|grep $vb_latest_ver|grep -v latest|grep virtualbox-kernel-[0-9]) +depkern=$(echo "$allkernels"|cut -d' ' -f1|grep $vb_latest_ver|grep -v latest|grep virtualbox-kernel-[0-9]) kern_ver=$(echo $depkern|cut -d- -f3-|cut -d- -f1) kern_rel=$(echo $depkern|cut -d- -f5-|cut -d. -f1) [[ ${#kern_ver} > 0 ]] && [[ ${#kern_rel} > 0 ]] && qavkern="${kern_ver}-${kern_rel}" @@ -312,11 +312,11 @@ kern_rel=$(echo $depkern|cut -d- -f5-|cut -d. -f1) # Get the kernel version and release required by the installed xtables-addons-flavour-latest get_xtables_kern() { if echo "$allkernels"|grep -q "xtables-addons-${kernelType}-latest"; then - xt_latest_ver=$(echo "$allkernels"|grep kernel-|grep "xtables-addons-kernel"|grep "latest"|cut -d- -f6-|rev|cut -d. -f2-|rev) + xt_latest_ver=$(echo "$allkernels"|cut -d' ' -f1|grep kernel-|grep "xtables-addons-kernel"|grep "latest"|cut -d- -f6-|rev|cut -d. -f2-|rev) else qaxkern=; return fi -depkern=$(echo "$allkernels"|grep $xt_latest_ver|grep xtables-addons-kernel-[0-9]|cut -d ' ' -f1) +depkern=$(echo "$allkernels"|cut -d' ' -f1|grep $xt_latest_ver|grep xtables-addons-kernel-[0-9]|cut -d ' ' -f1) kern_ver=$(echo $depkern|cut -d- -f4) kern_rel=$(echo $depkern|cut -d- -f6 -|cut -d. -f1) [[ ${#kern_ver} > 0 ]] && [[ ${#kern_rel} > 0 ]] && qaxkern="${kern_ver}-${kern_rel}" |