Log Files from bash script output
Posted
by
neildeadman
on Super User
See other posts from Super User
or by neildeadman
Published on 2011-06-21T11:17:08Z
Indexed on
2011/06/28
8:24 UTC
Read the original article
Hit count: 273
I have a script that runs (this works fine).
I'd like to produce logfiles from its output and still show it on screen. I have this command that creates three files from this blog:
((./fk.sh 2>&1 1>&3 | tee errors.log) 3>&1 1>&2 | tee output.log) 2>&1 | tee final.log
This does exactly what I want it to.
My only issue is that I create files in my script and copy them somewhere, and I'd like to copy these logfiles there too, which I can't do whilst this script is running. I also wanted to make it easier for any user to run my script, so I created another script to run this script. According to this post (see last post) I can put a .
before the script name and I can use variables assigned in my called script from the first script if I use them in the first.
It doesn't seem to work though and I can't figure out why or find alternative methods.
Can anyone help?
© Super User or respective owner