[K12OSN] command to change the private network settings for K12LTSP

Scott Sherrill scott at remc1.org
Wed Nov 2 15:54:07 UTC 2005


Henry Burroughs wrote:

> Is there a script to change all the private network settings 
> (/etc/hosts, lts.conf, and other files)?  That way if someone is 
> trying to deploy it already on a 192.168.0.* network, they can 
> "instantly" switch over to a network of their choice?
>
> I am giving a presentation Friday at SCISA in SC, and I want to be 
> prepared! =)



A crudely cobbled solution written in less than 5 lines.

!Please! be careful with its use.  ;-) 

The script takes 3 items from the command line and changes all items 
specified first with items specified second in the file specified third

ex call: quickhack 192.168.0 10.1.1 /etc/hosts 

The example above would change all 192.168.0 with 10.1.1 in /etc/hosts


#!/bin/sh
perl -pi -e "s/$1/$2/g" $3


Do with it as you will.

Scott






More information about the K12OSN mailing list