shell-script-pt
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [shell-script] Como pegar o próximo dia (data) de uma data


From: Gustavo Chaves
Subject: Re: [shell-script] Como pegar o próximo dia (data) de uma data
Date: 19 May 2005 13:36:20 -0300
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4

>>>>> On 19 May 2005 12:54:32 -0300, Gustavo Chaves <address@hidden> said:

  >     echo $1 | sed 's/\(..\)\(..\)\(....\)/date -d "\3\2\1 + 1 day"/' | sh

Melhor ainda, pois evita invocar outra shell:

  eval $(echo $1 | sed 's/\(..\)\(..\)\(....\)/date -d "\3\2\1 + 1 day"/')

Ainda melhor, usando umas formas sofisticadas de expansão de
variáveis, o que evita qualquer sub-processo:

  date -d "${1:4}${1:2:2}${1:0:2} + 1 day"

Gustavo.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]