Bash echo date+string in the same line
I would like to print the date followed by a string (an indication of what's going on at that time) to a file. With this intention I've tried
Code:
date >> date.txt && echo "something start" >> date.txt Code:
Sun May 17 01:08:28 BRT 2015 Code:
Sun May 17 01:08:28 BRT 2015 something start |
Code:
echo "`date` " >> date.txt && echo "something start" >> date.txt |
Code:
[schneidz@hyper ~]$ date +Y"-hello world-"%j |
I'm opting for short @schneidz's way. Thanks!
|
Quote:
Code:
mike@continuity7:~$ date +Y"-hello world-"%j Code:
Sun May 17 01:08:28 BRT 2015 something start Code:
mike@continuity7:~$ date "+%Y %j hello world" Code:
mike@continuity7:~$ echo "$(date) something start" |
MYVAR=$(date) && echo "$MYVAR ciao"
|
Quote:
|
All times are GMT -5. The time now is 12:05 AM. |