I have the following code in a Bash script, which takes the current date/time and sets it via SSH on a target computer:
ssh <user>@<target> "date --set '$(date)'"
This was working fine with various Ubuntu distros, but recently the target changed to another flavour of Linux and I get “invalid date” error.
What is the correct way to do this, which should work for any version of Linux?