4 January, 2022

Bash Shell

Function

Function parameter are accessed through positions like $1, $2.

now() {
  dt=`date '+%Y-%m-%d %H:%M:%S'`
}

log() {
  now
  echo "$dt $1" >> /var/log/publish-teach.log
}

log "Start publish tea.ch"