Re: Adding Date & Time to a script's output log
- Date: Thu, 1 Jun 2017 09:30:57 -0500
- From: David Wright <deblis@xxxxxxxxxxxxxxxxx>
- Subject: Re: Adding Date & Time to a script's output log
On Thu 01 Jun 2017 at 14:26:00 (+0000), SUZANNE COBB wrote:
> List, good afternoon,
> I am using a script to check and update a dynamic IP address in our DNS records. I have tried to add a date and time output to a log file which records IP address changes and updates - but the change I inserted is not working. I think the problem is that I have not understood correctly how to capture the *text* of the date and time, and then add it to a script 'echo' output line. May I show the two lines I am using?
> I try to capture the date and time into a variable named 'dt':
> dt= $(date '+%d/%m/%Y %H:%M:%S');
> [please see there is a space between = and $, and between Y and %]
Remove the first of them. Your line will set dt to nothing,
then it will try to run the output of date as a command.
"01/06/2017" is not a very useful command.