[Bash] A simple log file with script

Create a logger.sh file

#!/bin/bash
echo `date +'%T %F'` $* >> `date +%F`.log

$*: Represents all script arguments

Example

$ logger hello
$ logger hello world

Script will save hello and hello world into the log file

posted @ 2024-06-11 18:18  Zhentiw  阅读(2)  评论(0编辑  收藏  举报