LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Reply
 
Search this Thread
Old 03-11-2004, 01:49 AM   #1
philipina
Member
 
Registered: May 2003
Posts: 77

Rep: Reputation: 15
Change parameter of /etc/sysconfig/network with a script


Hello,

I'm a newbie in linux and I'm trying to make a script to change the hostname PC.
I get the hostname in $1.
My question are :

By using a script

1) How can I set this value in /etc/sysconfig/network "HOSTNAME=..."

2) How can I add this hostname in /etc/hosts
"127.0.0.1 localhost.localdomain localhost ..."

Thanks in advance for your help.

A.
 
Old 03-11-2004, 12:59 PM   #2
jailbait
Guru
 
Registered: Feb 2003
Location: Blue Ridge Mountain
Distribution: Debian Wheezy, Debian Jessie
Posts: 7,469

Rep: Reputation: 154Reputation: 154
"By using a script

1) How can I set this value in /etc/sysconfig/network "HOSTNAME=..."

2) How can I add this hostname in /etc/hosts
"127.0.0.1 localhost.localdomain localhost ...""

The heart of your script will be two sed commands. One sed command will be used to change /etc/hosts and the other sed command will be used to change /etc/sysconfig/network.

Here is an explanation of how to use sed:

http://wiki.sourcemage.org/index.php?page=HOWTO-Sed

___________________________________
Be prepared. Create a LifeBoat CD.
http://users.rcn.com/srstites/LifeBo...home.page.html

Steve Stites
 
  


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
How to change /etc/sysconfig/network-scripts/ifcfg-eth0 ariana Linux - Networking 1 05-01-2005 01:37 PM
How to change library parameter? blachan Linux - Newbie 0 07-12-2004 06:16 AM
Change parameter of /etc/sysconfig/network with a script philipina Linux - General 3 03-11-2004 05:05 AM
How to change parameter values of a function in shell script? Bassam Programming 0 01-25-2004 09:52 AM
/etc/sysconfig/network ssrikant Linux - Software 1 05-18-2003 03:30 PM


All times are GMT -5. The time now is 05:28 AM.

Main Menu
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