![]() |
|
|
google unix.com
|
|||||||
| Forum | Registrati | Regole Forum | Collegamenti | Album | FAQ | Members List | Calendario | Ricerca | Today's Posts | Mark Forums Read |
| UNIX e avanzata per utenti esperti Expert-to-Expert. Ulteriori avanzata UNIX, comandi UNIX, Linux, Sistemi Operativi, System Administration, Programmazione, Shell, Shell Script, Solaris, Linux, HP-UX, AIX, OS X, BSD. |
Più di UNIX e Linux Forum Argomenti potreste trovare utili
|
||||
| Filo | Thread Starter | Forum | Risposte | Ultimo Post |
| Aiuto, ho bisogno di avere l'ultima data del mese precedente | sirrtuan | Shell scripting e di programmazione | 11 | 10-14-2008 06:59 AM |
| Usa data comando per trovare il mese scorso | Cbish68 | Shell scripting e di programmazione | 5 | 08-10-2007 11:32 AM |
| scoprire mesi a partire da una data | rudoraj | UNIX for Dummies Domande & Risposte | 5 | 07-03-2007 09:21 AM |
| Formattazione Data (l'aggiunta di un mese) | Devid | UNIX for Dummies Domande & Risposte | 4 | 01-18-2006 10:31 AM |
| come arrivare mese scorso data in UNIX | rajan_ka1 | Shell scripting e di programmazione | 12 | 10-04-2005 08:20 AM |
![]() |
|
|
LinkBack | Thread Tools | Cerca in questo Thread | Rate Thread | Modalità di visualizzazione |
|
|
|
||||
|
ultima data di fine mese
Salve,
Come raggiungere l'ultimo mese della data di fine? (hanno la data corrente) attraverso s script di shell. Ho bisogno di farlo e di passare ad una procedura. Si prega di consulenza. Grazie in anticipo. |
|
||||
|
Per riferimento futuro, se qualcuno legge questo: provare cal Codice:
#!/bin/ksh
printf "%d %d" $(date "+%Y %m") | read year month
let month=$month-1
if [[ $month -eq 0 ]] ; then
let year=$year-1
let month=12
fi
cal $month $year | tr -s '\n' ' ' | awk '{print $NF}' | read day
printf "%d/%02d/%02d\n" $year $month $day
Ultima modifica di Jim McNamara; al 03/21/2008 01:01 PM.. Motivo: cambiato mesi \u003d 1 al mese \u003d 12 |
|
||||
|
Perlapproccio basato derivanti indietro nel tempo ... non ho molto la briga di cercare di tornare al futuro, come ancora. Ma anche gli anni bisestili maniglie ... Codice:
$ pl_end_of_last_month_0=`perl -e '\ > $y= time - (86400 * (localtime(time))[3]); \ > printf "%04d%02d%02d\n", (localtime($y))[5] + 1900 ,(localtime($y))[4] + 1 ,(localtime($y))[3] ; ' ` $ echo $pl_end_of_last_month_0 20070831 === Codice:
$ # Today...
$ pl_today_0=`perl -e '\
> $y= time - (86400 * $ARGV[0]); \
> printf "%04d%02d%02d\n", (localtime($y))[5] + 1900 ,(localtime($y))[4] + 1 ,(localtime($y))[3] ; ' 0 `
$ echo $pl_today_0
20070912
===
$ # Today minus 1... (um, yesterday...?)
$ pl_today_1=`perl -e '\
> $y= time - (86400 * $ARGV[0]); \
> printf "%04d%02d%02d\n", (localtime($y))[5] + 1900 ,(localtime($y))[4] + 1 ,(localtime($y))[3] ; ' 1 `
$ echo $pl_today_1
20070911
===
$ # Today minus a defined number...
$ my_number=3
$ pl_today_mynumber=`perl -e '\
> $y= time - (86400 * $ARGV[0]); \
> printf "%04d%02d%02d\n", (localtime($y))[5] + 1900 ,(localtime($y))[4] + 1 ,(localtime($y))[3] ; ' ${my_number} `
20070909
===
|
|
||||
|
Citazione:
|
![]() |
| Segnalibri |
| Thread Tools | Cerca in questo Thread |
| Modalità di visualizzazione | Vota questo thread |
|
|