Veröffentlicht 3. März 200619 j Hallo, ich habe eine Zahl, z.Bsp. 1141408532 Wie muss ein Shell-Skript aussehen, um aus der Unix-Time eine "normal" Leserliche Datums- und Zeitangabe zu errechnen? Ich stelle mir das so vor dass ich die Zahl als Parameter an das Skript übergebe, und es mir als Antwort dann 03.03.2006 17:55:32 ausgibt.... Ich bin allerdings nicht so der Shell-Gott....
3. März 200619 j Autor Danke für den Tipp Bei meiner Distribution www.openwrt.org funktioniert dass jedoch nicht so ganz: Irgendwie sind das 2 Stellen zuviel: root@OpenWrt:/# date Fri Mar 3 18:49:11 UTC 2006 root@OpenWrt:/# date -d "1970-01-01 1141408532 sec" date: invalid date `1970-01-01 1141408532 sec' root@OpenWrt:/# date --help BusyBox v1.00 (2005.11.23-21:46+0000) multi-call binary Usage: date [OPTION]... [MMDDhhmm[[CC]YY][.ss]] [+FORMAT] Displays the current time in the given FORMAT, or sets the system date. Options: -R Outputs RFC-822 compliant date string -d STRING Displays time described by STRING, not `now' -I[TIMESPEC] Outputs an ISO-8601 compliant date/time string. TIMESPEC=`date' (or missing) for date only, `hours', `minutes', or `seconds' for date and, time to the indicated precision. -s Sets time described by STRING -r FILE Displays the last modification time of FILE -u Prints or sets Coordinated Universal Time root@OpenWrt:/# date -d 1141408532 date: invalid date `1141408532' root@OpenWrt:/# date -d 11414085 Tue Dec 12 17:25:00 UTC 2006 root@OpenWrt:/# date -d 114140850 date: invalid date `114140850' root@OpenWrt:/# date -d 11414000 Tue Dec 12 16:00:00 UTC 2006
3. März 200619 j Autor Nachtrag: Oder ist es irgendwie möglich, die Zeit z.Bsp. 1141415772 irgendwie in einen crontab Eintrag zu konvertieren?
Archiv
Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.