[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [shell-script] Colocar o ip em arquivo
From: |
Guilherme Salgado |
Subject: |
Re: [shell-script] Colocar o ip em arquivo |
Date: |
Mon, 26 Nov 2001 14:06:57 -0200 |
Olá a todos,
On Mon, 26 Nov 2001 01:15:35 -0200 (BRST)
"Fabricio Barros Cabral \"FX\"" <address@hidden> wrote:
>
> On Sun, 25 Nov 2001, Guilherme Salgado wrote:
>
> Excelente script, mas só modificando umas coisinhas (pra ficar "melhor
de
> bão" :P)
>
> > #!/bin/sh
> > ip_atual=`ifconfig eth0 | grep inet | sed -e 's/ *//' -e 's/inet
addr://'
> > -e 's/ .*//'`
>
> ip_atual=`/sbin/ifconfig eth0 | grep inet | cut -b21-31`
Eu havia pensado numa solucao semelhante a essa, mas isso so funciona se o
IP tiver exatamente 11 caracteres (e.g., 192.168.0.x). Aqui na minha
interface eth1 (200.210.132.123) ele so pega os 11 primeiros caracteres
(200.210.132) e vai dar problema na hora de rodar o httpd.
>
> > ip_antigo=`cat /etc/httpd/conf/ip.conf | cut -d " " -f 2`
>
> ip_antigo=`cut -d " " -f 2 /etc/httpd/conf/ip.conf`
Aqui esta corretissimo, as vzs eu me esqueco que muitas vzs o "cat" pode
ser evitado.
[]'s
--
Guilherme