changing default to zero
hi, i need to change the default boot order from any number to zero via a script. let me assume the following
# grub.conf generated by anaconda # # Note that you do not have to rerun grub after making changes to this file # NOTICE: You have a /boot partition. This means that # all kernel and initrd paths are relative to /boot/, eg. # root (hd0,2) # kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00 # initrd /initrd-version.img #boot=/dev/sda default=1 timeout=10 splashimage=(hd0,2)/grub/splash.xpm.gz hiddenmenu title Fedora (2.6.27.5-117.fc10.i686) root (hd0,2) kernel /vmlinuz-2.6.27.5-117.fc10.i686 ro root=UUID=108b1257-bc22-48d6-afab-2666b96d0dc8 rhgb quiet initrd /initrd-2.6.27.5-117.fc10.i686.img title Microsoft Windows Vista Ultimate rootnoverify (hd0,0) chainloader +1 here, the default boot order is 1. i need a script that would change it from 1 to 0 . i tried sed 's/default=[0-9]*/default=0/' /boot/grub/grub.conf but it only displays the boot order changed to zero but in reality the boot order is the same . please help me. |
Why aren't you saving the output?
# sed 's/default=[0-9]*/default=0/' /boot/grub/grub.conf > /boot/grub/grub.conf (make sure you keep an update of the original when doing this) |
it makes the file empty.
|
Quote:
Code:
sed -e 's/default=[0-9]*/default=0/' /boot/grub/grub.conf > grub.new Code:
sed -e 's/default=[0-9]*/default=0/' -i /boot/grub/grub.conf |
Code:
# sed 's/default=[0-9]*/default=0/' /boot/grub/grub.conf > /boot/grub/grub.conf Quote:
|
the new file is also empty. i tried both the options you stated , well before posting the thread,but couldn`t do it . it doesn`t work. only empty file is created. may be a c program that will make use of array to check "default" and change the value from any number to zero would work. i should try it, if shell fails.
if you have some other suggestions or options, do post me. |
Quote:
PS. If this command shows the correct output: Code:
sed 's/default.*[0-9]*/default 0/' /boot/grub/grub.conf Code:
sed 's/default.*[0-9]*/default 0/' /boot/grub/grub.conf > grub.new Code:
sed 's/default.*[0-9]*/default 0/' /boot/grub/grub.conf -i |
thanks for ur reply!!!! though the first two failed, last one, sed 's/default.*[0-9]*/default 0/' /boot/grub/grub.conf -i
successfully did the job. thank you |
All times are GMT -5. The time now is 01:43 PM. |