#!/bin/bash Boot_CONFIG=/boot/grub/grub.conf ROOT=$(cat /boot/grub/grub.conf |grep -v ^# |grep title | nl -b a -v 0 | grep -w with | awk '{print $1}') NOROOT=$(cat /boot/grub/grub.conf |grep -v ^# | grep title | nl -b a -v 0 | grep -w without | awk '{print $1}') if [ "$1" = "root" ];then sed -i "/default/s@[0-9]@${ROOT}@" $Boot_CONFIG elif [ "$1" = "noroot" ];then sed -i "/default/s@[0-9]@${NOROOT}@" $Boot_CONFIG else echo "Usage:[root | noroot]" exit 1 fi