The logger command writes a message to the system log. It is useful in shell scripts when you want an action to leave a trace in the logs.
Basic use
logger "backup script started"You can add a tag so the message is easier to find later.
logger -t backup-script "backup completed successfully"Depending on the distribution, you can view these messages using journalctl or traditional log files.
journalctl -t backup-script