Sponsored Content
Full Discussion: Change $HOST in /etc/hosts
Top Forums Shell Programming and Scripting Change $HOST in /etc/hosts Post 302303982 by figaro on Saturday 4th of April 2009 07:20:35 AM
Old 04-04-2009
Change $HOST in /etc/hosts

I want to change the following lines in /etc/hosts on FreeBSD:
Code:
::1         localhost localhost.my.domain
127.0.0.1       localhost localhost.my.domain

into the following lines
Code:
::1         localhost foo.example.com
127.0.0.1       localhost foo.example.com

I have the following script to do that:
Code:
# set subdomain in hosts file
sed -i '' -e 's/localhost.my.domain/$HOST/' /etc/hosts

in an attempt to use the prepopulated environment variable $HOST for that. But the result is as follows:
Code:
::1         localhost $HOST
127.0.0.1       localhost $HOST

What can I do to correct this? Thanks in advance
 

10 More Discussions You Might Find Interesting

1. AIX

NIM host name change

Hi I have a NIM server on AIX 5.3.08.02. I had to change the host name and I now have nimsh connection issues to the NIM clients. All host files and DNS entries are correct with the new host name. I have tried editing the niminfo files on the NIM server and NIM clinet. I have tried removing the... (2 Replies)
Discussion started by: kimyo
2 Replies

2. Shell Programming and Scripting

change password for multiple host

1-How can i change root password of 5 Fedora 11 machines (server1 server2 server3 server4 server5) with a single script , for example make password : 123456 NB. from server1 i can via ssh connect to the others machines without a password Please help. (3 Replies)
Discussion started by: chang-lee
3 Replies

3. Shell Programming and Scripting

Change .bashrc on a list of hosts

Hi, My scripting skills are somewhat basic... I need a way to log into a list of hostname/IPs as a user, su to root and then create/append root's .bashrc Thanks (0 Replies)
Discussion started by: jag7720
0 Replies

4. Shell Programming and Scripting

ssh to multiple hosts and saving the output in the local host

hi I have a script to login from a host "A" to a list of hosts in a file and perform some commands inside it...its somethin like this for i in `cat file` do ssh -t $i " command1 ; command2; ..." done I wanna save the outputs in a file in the current host "A" i.e from where I am... (3 Replies)
Discussion started by: ningy
3 Replies

5. Shell Programming and Scripting

rsh to many hosts the ftp output to single host

Hi guys. i need some help, i need to create a script in tcsh that rsh into all my hosts that we have at our business, then cd to a directory (cd /apps/users) then grab a file from the users folder and ftp it back to my windows machine. can someone please help? Kind regards. Brian Behrens (2 Replies)
Discussion started by: brian112
2 Replies

6. Solaris

Can't change fully qualified host name

I tried changing my /etc/inet/hosts file for my server to: <ip address> <hostname> <fqdn> but when I go to reboot the file changes right back to: <ip address> <hostname> how do I get the <fqdn> to stick on a reboot. Thanks (2 Replies)
Discussion started by: jastanle84
2 Replies

7. Solaris

able to ping all hosts but not able to traceroute any host

i am using solaris 10 and i am able to ping all the hosts but i am not able to traceroute any of them. how to fix this? (9 Replies)
Discussion started by: chidori
9 Replies

8. Shell Programming and Scripting

Copy a file from local host to a list of remote hosts --- perl script

Hi friends, i need to prepare a script ( in perl) i have a file called "demo.exe" in my local unix host. i have a list of remote hosts in a file "hosts.txt" now i need to push "demo.exe" file to all the hosts in "hosts.txt" file. for this i need to prepare a script(in perl, but shell... (5 Replies)
Discussion started by: siva kumar
5 Replies

9. Solaris

How to copy a tar file on a series of remote hosts and untar it on those hosts?

Am trying to copy a tar file onto a series of remote hosts and untar it at the destination. Need to do this without having to do multiple ssh. Actions to perform within a single ssh session via shell script - copy a file - untar at destination (remote host) OS : Linux RHEL6 (3 Replies)
Discussion started by: sankasu
3 Replies

10. Solaris

Change from weak ssh host key to strong one

Hi, I got instructions from Security audit team for Solaris-10 server. They mentioned - "The sshd configuration on the host supported weak host keys and allowed password authentication on Solaris server. Enable stronger keys (2048 or 4096 bit)". I am not clear enough, what they mean by weak... (7 Replies)
Discussion started by: solaris_1977
7 Replies
BTHOST(1)						    BSD General Commands Manual 						 BTHOST(1)

NAME
bthost -- look up Bluetooth host names and Protocol Service Multiplexor values SYNOPSIS
bthost [-bhp] host_or_protocol DESCRIPTION
The bthost utility looks for information about Bluetooth hosts and Protocol Service Multiplexor (PSM) values. It gets this information from the /etc/bluetooth/hosts and /etc/bluetooth/protocols files. In host mode, it simply converts between the host names and Bluetooth addresses. The argument can be either a host name or a Bluetooth address. The program first attempts to interpret it as a Bluetooth address. If this fails, it will treat it as a host name. A Bluetooth address consists of six hex bytes separated by a colon, e.g., ``01:02:03:04:05:06''. A host name consists of names separated by dots, e.g., ``my.cell.phone''. In protocol mode, it simply converts between the Protocol Service Multiplexor names and assigned numbers. The argument can be either a Pro- tocol Service Multiplexor name or an assigned number. The program first attempts to interpret it as an assigned number. The options are as follows: -b Produce brief output. -h Display usage message and exit. -p Activate protocol mode. The bthost utility will print results to the standard output, and error messages to the standard error. An output can be quite different, here is an example that demonstrates all of the possibilities: % bthost localhost Host localhost has address FF:FF:FF:00:00:00 % bthost ff:ff:ff:00:00:00 Host FF:FF:FF:00:00:00 has name localhost % bthost -b localhost FF:FF:FF:00:00:00 % bthost -b ff:ff:ff:00:00:00 localhost % bthost do.not.exists do.not.exists: Unknown host % bthost 0:0:0:0:0:0 00:00:00:00:00:00: Unknown host % bthost -p sdp Protocol/Service Multiplexor sdp has number 1 % bthost -p 3 Protocol/Service Multiplexor rfcomm has number 3 % bthost -bp HID-Control 17 % bthost -p foo foo: Unknown Protocol/Service Multiplexor FILES
/etc/bluetooth/hosts /etc/bluetooth/protocols EXIT STATUS
The bthost utility exits 0 on success, and >0 if an error occurs. SEE ALSO
bluetooth(3), bluetooth.hosts(5), bluetooth.protocols(5) AUTHORS
Maksim Yevmenkin <m_evmenkin@yahoo.com> BSD
May 8, 2003 BSD
All times are GMT -4. The time now is 11:40 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy