[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [shell-script] Colocar o ip em arquivo
From: |
Fabricio Barros Cabral "FX" |
Subject: |
Re: [shell-script] Colocar o ip em arquivo |
Date: |
Mon, 26 Nov 2001 01:15:35 -0200 (BRST) |
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`
> ip_antigo=`cat /etc/httpd/conf/ip.conf | cut -d " " -f 2`
ip_antigo=`cut -d " " -f 2 /etc/httpd/conf/ip.conf`
> if [ "$ip_atual" != "$ip_antigo" ]
> then
> echo NameVirtualHost $ip_atual > /etc/httpd/conf/ip.conf
> /etc/init.d/httpd restart
> fi
Abracao,
--fx
From (no email address) Mon Nov 26 04:11:55 2001
Return-Path: <address@hidden>
X-Sender: address@hidden
X-Apparently-To: address@hidden
Received: (EGP: mail-8_0_0_1); 26 Nov 2001 12:11:52 -0000
Received: (qmail 36663 invoked from network); 26 Nov 2001 12:11:51 -0000
Received: from unknown (216.115.97.172)
by m8.grp.snv.yahoo.com with QMQP; 26 Nov 2001 12:11:51 -0000
Received: from unknown (HELO perninha.conectiva.com.br) (200.250.58.156)
by mta2.grp.snv.yahoo.com with SMTP; 26 Nov 2001 12:11:51 -0000
Received: from burns.conectiva (burns.conectiva [10.0.0.4])
by perninha.conectiva.com.br (Postfix) with SMTP id 569F538C3F
for <address@hidden>; Mon, 26 Nov 2001 09:11:36 -0300 (EST)
Received: (qmail 10926 invoked by uid 0); 26 Nov 2001 12:08:22 -0000
Received: from verde.conectiva (10.0.2.168)
by burns.conectiva with SMTP; 26 Nov 2001 12:08:22 -0000
Date: Mon, 26 Nov 2001 10:12:22 -0200 (BRST)
X-X-Sender: <verde@verde.conectiva>
To: <address@hidden>
Subject: Re: [shell-script] Dias Uteis
In-Reply-To: <address@hidden>
Message-ID: <Pine.LNX.4.33L.0111261010500.948-100000@verde.conectiva>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=iso-8859-1
Content-Transfer-Encoding: 8BIT
X-eGroups-From: # aurelio marinho jargas <address@hidden>
From: # aurelio marinho jargas <address@hidden>
X-Yahoo-Profile: verde6666
@ 23/11, Beraldo Leal:
> On Fri, Nov 23, 2001 at 07:57:17PM -0500, Silvano B. Dias wrote:
> > Minha sugestao e':
> >
> > cal $mes $ano | sed -n -e 's/ / # /g' -e 's/ / #/g' -e 's/^ /#/' -e
> > '3,$p' | cut -d ' ' -f 2-6 | tr '#' ' ' | wc -w
> Ae pessoal agradeco... talvez eu tenha me expressado mal...
> mas como he uma questao de uma prova.. na propria questao..
> ele diz: usando os comandos: cal, tail, cut e wc, ou seja,
> sed NADA! :( ai.. num sei se vcs me ajudarem eu agradeco!
putz, especificar QUAIS comandos devem ser usados é chinelo,
pois você pode resolver este problema de uma infinidade de
maneiras diferentes.
mas pelo menos eles foram e especificaram as ferramentas até na
ordem certa de aplicação:
cal 11 2001 | tail -6 | cut -c4-17 | wc -w
--
http://verde666.org s/click/^a]/;^[:wq