[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [shell-script] Manter arquivo mais recente.
From: |
Jose NIEVIADONSKI |
Subject: |
Re: [shell-script] Manter arquivo mais recente. |
Date: |
Thu, 24 Oct 2002 09:39:33 -0300 |
Oi.
Troque então a linha
orig=${arq:##*/}
por
orig=$(basename $arq)
Um pouco mais lento mas acho que funciona
Ou então tenta executar no ksh se você o possuir na sua máquina.
[]'s a todos
José Augusto Martins Nieviadonski
Analista de Suporte Consultor
HSBC Bank Brasil S.A. Banco Multiplo
Treinamento de Informática
address@hidden
Enviado Por : <address@hidden> - 24/10/02 01:46
Responder a shell-script
Para: <address@hidden>
cc: (cco: Jose NIEVIADONSKI/HBBR/HSBC)
Assunto: Re: [shell-script] Manter arquivo mais recente.
nao funfou no bash!
=(
su: arq: ##*/: syntax error: operand expected (error token is
"##*/")
Reinaldo
>
>
>
>
>
> Oi.
>
> Não tive tempo de testar exaustivamente o script abaixo, mas
> acho que funciona.
>
> #!/usr/bin/ksh
>
> find /zeus/root/home/squirrel/ -type f |
> while read arq
> do
> orig=${arq:##*/}
> if [[ ! -f /home/squirrel/$orig ]]
> then
> echo Arquivo $arq nao existe. Copiando $arq para /home/squirrel/$orig
> cp $arq home/squirrel/$orig
> else
> if [[ $arq -nt /home/squirrel/$orig ]]
> then
> echo Arquivo $arq mais novo. Copiando $arq para
/home/squirrel/$orig
> cp $arq /home/squirrel/$orig
> fi
> fi
> done
>
> Estou supondo que existe pelo menos a mesma estrutura de
> diretórios e subdiretórios nos dois diretórios citados.
>
>
> José Augusto Martins Nieviadonski
> Analista de Suporte Consultor
> HSBC Bank Brasil S.A. Banco Multiplo
> Treinamento de Informática
> address@hidden
>
The information contained in this e-mail is confidential. It may also be legally
privileged. If you are not the addressee you may not copy, forward, disclose
or use any part of it. If you have received this message in error, please
delete it
and all copies from your system and notify the sender immediately by return
e-mail.
E-mail communications cannot be guaranteed to be timely secure, error or
virus-free.
The sender does not accept liability for any errors or omissions which arise as
a result.