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

Re: bash - date format



Am 2009-01-31 00:31:44, schrieb Matthias Meyer:
> Hallo,
> 
> Ich kriegs irgendwie nicht hin den date Befehl in eine Variable zu packen.
> Also fast nicht ;-)
> timestamp="date +%Y/%m/%d_%T"
> echo "`$timestamp - text"
> funktioniert.
> Aber
> timestamp="date +%Y/%m/%d %T"
> echo "`$timestamp - text"
> funktioniert nicht. Also das BLANK vor dem %T will er nicht.
> 
> Was mache ich falsch?

    timestamp=$(date +"%Y/%m/%d_%T")
                      ^^^^^^^^^^^^^
                Der String muß in Anführungszeichen

    echo "${timestamp} - text"

und funktioniert enwandfrei...

Thanks, Greetings and nice Day/Evening
    Michelle Konzack
    Systemadministrator
    24V Electronic Engineer
    Tamay Dogan Network
    Debian GNU/Linux Consultant


-- 
Linux-User #280138 with the Linux Counter, http://counter.li.org/
##################### Debian GNU/Linux Consultant #####################
<http://www.tamay-dogan.net/>               <http://www.can4linux.org/>
Michelle Konzack   Apt. 917                  ICQ #328449886
+49/177/9351947    50, rue de Soultz         MSN LinuxMichi
+33/6/61925193     67100 Strasbourg/France   IRC #Debian (irc.icq.com)

Attachment: signature.pgp
Description: Digital signature


Reply to: