script edit file..
after finished installed redhat linux, i got a script that clean some stuff that i dont' want , what i want it's some command that automatic change grub.conf
timeout=30 to 0, so i don't have to manual do it when i setup a lots machine on my network.. here's my grub file... # 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,0) # kernel /vmlinuz-version ro root=/dev/hda2 # initrd /initrd-version.img #boot=/dev/hda default=0 timeout=30 ------------------------------------->> change to 0 splashimage=(hd0,0)/grub/splash.xpm.gz title Red Hat Linux (2.4.20-8) root (hd0,0) kernel /vmlinuz-2.4.20-8 ro root=LABEL=/ hdc=ide-scsi initrd /initrd-2.4.20-8.img thank you |
Here's a script that should do the job for you. I've tested it some, but don't blame me if anything goes wrong. You'll obviously need perms to edit /etc/grub.conf, but other than that, this should work right off the bat.
#Grub append script cat /etc/grub.conf | while read cur_line do if [[ $cur_line = "timeout=30" ]] ; then echo "timeout=0" >> /tmp/grub-copy.conf else echo $cur_line >> /tmp/grub-copy.conf fi done mv /tmp/grub-copy.conf /etc/grub.conf |
thanks it work's...
|
could you please explain a little about you script..
the part i dont' understand it's that echo "timeout=0" >> /tmp/grub-copy.conf i thought it would be on the top when "timeout=0" echo to /tmp/grub-copy.conf but it's not ??? thanks |
Basically what it's doing is reading each line of /etc/grub.conf and appending that line to a file called /tmp/grub-copy.conf. When it reads the line "timeout=30" it stops appending the read lines and instead appends "timeout=0". Then it continues appending read lines.
|
All times are GMT -5. The time now is 04:17 AM. |