[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  阅读(13)  评论(0)    收藏  举报