The UNIX and Linux Forums  

Go Back   O UNIX e Linux Forum > Top Fóruns > Programação Shell Script e
.
google unix.com



Programação Shell Script e Post perguntas sobre ksh, CSH, SH, BASH, Perl, PHP, SED, Awk e outros scripts shell e shell scripts línguas aqui.

Mais UNIX e Linux Fórum Tópicos Você pode achar Helpfull
Fio Thread Starter Fórum Respostas Última postagem
Como obter o mês anterior, em Korn Shell nvuradi Programação Shell Script e 1 03-19-2008 12:31
Como encontrar o primeiro dia do mês anterior, em unix? MOHAPATRA Programação Shell Script e 10 07-02-2007 09:57
Especifique uma data anterior como data de início na shell script ritzwan0 Programação Shell Script e 2 09-25-2006 06:58
Como obter ficheiros mês anterior savitha Programação Shell Script e 7 03-23-2006 05:16
nome do arquivo usando mês anterior beilstwh Programação Shell Script e 1 08-04-2004 05:21

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
Linkback Thread Tools Pesquisar este Thread Rate Thread Display Modes
  #1 (permalink)  
Old 02-25-2008
sirrtuan sirrtuan is offline
Usuário
  
 

Join Date: Feb 2008
Lugares: 18
Ajuda, Preciso de ir buscar a última data do mês anterior

Oi, sou novo no Unix, estou tentando conseguir um último dia do mês anterior, com este formato:% b% d% Y (exemplo: 25 fev 2008).
Aqui está o que tenho até agora.

#! / bin / ksh
cur_month \u003d `date +% m`
cur_year \u003d `date +% Y`
prev_month \u003d$(($ cur_month-1))

# Verifique para ver se este é jan.
if [$ prev_month-lt 1]
então
prev_year \u003d$(($ cur_year-1))
prev_month \u003d 12
LastDayOfMonth \u003d `/ bin / cal $ prev_month $ prev_year | grep-v" ^ $ "| tail -1 | awk '(print $ NF)'`
diferente
LastDayOfMonth \u003d `/ bin / cal $ prev_month $ cur_year | grep-v" ^ $ "| tail -1 | awk '(print $ NF)'`
fi
\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u0
Eu posso fazer o último dia do mês anterior, mas não sei como colocá-la de volta para o formato que eu queria. Por favor, ajudem.

Obrigado.
 

Marcadores

Thread Tools Pesquisar este Thread
Pesquisar este Thread:

Pesquisa Avançada
Display Modes Esta taxa Thread
Esta taxa Thread:

Destacamento Regimento
Você não pode postar novas threads
Você não pode postar respostas
Você não pode postar anexos
Você não pode editar suas postagens

BB code é Ligado
Smilies são Ligado
[IMG] código é Ligado
Código HTML é Desligado
Trackbacks são Ligado
Pingbacks são Ligado
Refbacks são Ligado




Todos os horários são GMT -4. A hora é agora 02:02.


Powered by: vBulletinCopyright © 2000 - 2006, Jelsoft Enterprises Limited. Língua Traduções Powered by .
vBCredits v1.4 Copyright © 2007 - 2008, PixelFX Studios
O UNIX e Linux Fóruns Content Copyright © 1993-2009. Todos os Direitos Reserved.Ad Gestão por RedTyger

Content Relevant URLs por vBSEO 3.2.0