In Linux, I know how to write a simply message to the /var/log/messages
file, in a simple shell script I created:
#!/bin/bash
logger \"have fun!\"
<
If you see the man page of logger:
$ man logger
LOGGER(1) BSD General Commands Manual LOGGER(1)
NAME logger — a shell command interface to the syslog(3) system log module
SYNOPSIS logger [-isd] [-f file] [-p pri] [-t tag] [-u socket] [message ...]
DESCRIPTION Logger makes entries in the system log. It provides a shell command interface to the syslog(3) system log module.
It Clearly says that it will log to system log. If you want to log to file, you can use ">>" to redirect to log file.