How to add an entry in a configration file using shell

Taking care of your Linux box.

How to add an entry in a configration file using shell

Postby we » Wed Jan 21, 2004 6:57 pm

How to add an entry in a configration file using shell without editing it...
Regards
EKF
+971 50 7861136
we
Lance Naik
 
Posts: 43
Joined: Wed Jan 21, 2004 6:36 pm
ICQ: 32164473
WLM: ekfarooqui@msn.com
Yahoo Messenger: ekfarooqui@yahoo.com
Location: Dubai, UAE

ans.

Postby s7r1k3r » Wed Jan 21, 2004 7:14 pm

echo "option=value" >> configuration_file

for example:

echo "servername=testhost" >> /etc/httpd.conf
a10n3 s7r1k3r
s7r1k3r
Battalion Quarter Master Havaldaar
 
Posts: 221
Joined: Wed Aug 07, 2002 3:02 pm
Location: Rawalpindi

Re: ans.

Postby LinuxFreaK » Sat Jan 24, 2004 3:52 am

Dear s7r1k3r,
Salam,

s7r1k3r wrote:echo "option=value" >> configuration_file
for example: echo "servername=testhost" >> /etc/httpd.conf


This will only works for apending file not for Editing or removing content of file :) if you want to remove file content of file then you can also use ...

# echo > filename
or
# cat > file

Best Regards.
Farrukh Ahmed
LinuxFreaK
Site Admin
 
Posts: 5132
Joined: Fri May 02, 2003 10:24 am
ICQ: 82075802
Website: http://www.linuxpakistan.net/wiki/index.php?pagename=LinuxFreak
WLM: f4fahmed@hotmail.com
Yahoo Messenger: f4fahmed@yahoo.com
AOL: linuxpakistan@aol.com
Location: Karachi

SED

Postby s7r1k3r » Sat Jan 24, 2004 2:06 pm

Of course, if you want full control, you can use sed.
a10n3 s7r1k3r
s7r1k3r
Battalion Quarter Master Havaldaar
 
Posts: 221
Joined: Wed Aug 07, 2002 3:02 pm
Location: Rawalpindi

Postby hb » Sat Jan 24, 2004 2:28 pm

aoa.

to edit most conf files u gota b root

if in shell u r not root

do 'su' command
then ur root passwd.

pwd
/home/username

cd /etc

vi resolv.con

then use vi commands.
initiallly it looks very irratiting, but later, u will enjoy it.
its so kewl.
i hav told u tool, now do google and get vi commands.
or man vi
blah..

hav phun
:p

tc all,
AH.
Never be afraid to try something new. Remember, amateurs built the ark; professionals built the Titanic. -- Anonymous
hb
Lance Naik
 
Posts: 36
Joined: Sun Jul 13, 2003 12:45 pm
Location: internet

Not to the point

Postby s7r1k3r » Sat Jan 24, 2004 8:38 pm

The author of this thread wanted to know how to edit without using an editor.
a10n3 s7r1k3r
s7r1k3r
Battalion Quarter Master Havaldaar
 
Posts: 221
Joined: Wed Aug 07, 2002 3:02 pm
Location: Rawalpindi


Return to “%s” Administration

Who is online

Users browsing this forum: No registered users and 1 guest

cron