Re: bash - date format
Michelle Konzack wrote:
> 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
>
>
Nee. Da steht in timestamp Datum und Uhrzeit zum Zeitpunkt der
Variablendeklaration.
Ich möchte aber das er Datum und Uhrzeit ermittelt wenn ich einen Log-Record
schreibe.
Lg
Matthias
--
Don't Panic
Reply to: