Link to home
Start Free TrialLog in
Avatar of rduval
rduvalFlag for Canada

asked on

Concatenate test with formatted output of DATE in Bash Script

I want to append a text string and the date together to the end of text file (a log actually).

I can output the date itself with
date +'%Y-%m-%d %H:%M:%S'

Open in new window

, no problem

I can append text to the file with
echo "Manual Restart Completed at " >> log/myservice.log

Open in new window

again, no problem.

But when I try something to put them together like:
echo "Manual Restart Completed at " DATE +'%Y-%m-%d %H:%M:%S' >> /var/log/myservice.log

Open in new window

it fails and I've googled for an hour and can't find the solution.
ASKER CERTIFIED SOLUTION
Avatar of farzanj
farzanj
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of rduval

ASKER

Bingo! Thanks!