Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

shell scripting error logging

I'm trying to setup a simple logging framework in my shell scripts. For this I'd like to define a "log" function callable as

log "LEVEL" $message

Where the message is a variable to which I have previously redirected the outputs of executed commands. My trouble is that I get errors with the following

{message=command 2>&3 1>&3 3>&-} >&3
log "INFO" $message

There's something wrong isn't there?

TIA

like image 676
Eddy Avatar asked Dec 15 '25 09:12

Eddy


1 Answers

I've developed a simple multi-level logger for my shell scripts, you can take a look for use, inspiration, or whatever you want.

like image 143
jmoreno Avatar answered Dec 17 '25 00:12

jmoreno



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!