Register a domain and help support LQ
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 01-22-2004, 02:02 AM   #1
Registered: Jun 2003
Posts: 92

Rep: Reputation: 15
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
timeout=30 ------------------------------------->> change to 0
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
Old 01-22-2004, 04:09 AM   #2
Registered: Oct 2003
Location: Tucson, AZ
Distribution: Mandrake 10.0 Official
Posts: 193

Rep: Reputation: 31

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
if [[ $cur_line = "timeout=30" ]] ; then
echo "timeout=0" >> /tmp/grub-copy.conf
echo $cur_line >> /tmp/grub-copy.conf

mv /tmp/grub-copy.conf /etc/grub.conf
Old 01-22-2004, 12:42 PM   #3
Registered: Jun 2003
Posts: 92

Original Poster
Rep: Reputation: 15
thanks it work's...
Old 01-22-2004, 12:57 PM   #4
Registered: Jun 2003
Posts: 92

Original Poster
Rep: Reputation: 15
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 ???

Old 01-22-2004, 05:50 PM   #5
LQ Addict
Registered: Dec 2003
Location: Maine, USA
Distribution: Slackware/SuSE/DSL
Posts: 1,320

Rep: Reputation: 45
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.

Last edited by mikshaw; 01-22-2004 at 05:52 PM.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Request for a simple net script edit <Ol>Origy Linux - Networking 0 06-03-2005 12:51 PM
Help with a script to edit text file (awk? sed?) rickh Linux - Newbie 8 04-21-2005 08:24 PM
how to edit Mozilla startup script? sufianmunir Linux - Newbie 2 06-21-2004 06:51 PM
Bash script to edit passwd without Root password? NetFlash Linux - Newbie 2 11-29-2003 04:22 PM
edit login script athenerx Linux - Newbie 1 07-21-2002 11:30 AM

All times are GMT -5. The time now is 03:54 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration