LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
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.

Notices



Reply
 
Search this Thread
Old 01-22-2004, 03:02 AM   #1
johnyy
Member
 
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
#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
 
Old 01-22-2004, 05:09 AM   #2
tk31337
Member
 
Registered: Oct 2003
Location: Tucson, AZ
Distribution: Mandrake 10.0 Official
Posts: 193

Rep: Reputation: 31
Talking

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
 
Old 01-22-2004, 01:42 PM   #3
johnyy
Member
 
Registered: Jun 2003
Posts: 92

Original Poster
Rep: Reputation: 15
thanks it work's...
 
Old 01-22-2004, 01:57 PM   #4
johnyy
Member
 
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 ???

thanks
 
Old 01-22-2004, 06:50 PM   #5
mikshaw
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 06:52 PM.
 
  


Reply


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 01:51 PM
Help with a script to edit text file (awk? sed?) rickh Linux - Newbie 8 04-21-2005 09:24 PM
how to edit Mozilla startup script? sufianmunir Linux - Newbie 2 06-21-2004 07:51 PM
Bash script to edit passwd without Root password? NetFlash Linux - Newbie 2 11-29-2003 05:22 PM
edit login script athenerx Linux - Newbie 1 07-21-2002 12:30 PM


All times are GMT -5. The time now is 02:49 AM.

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