please rename this post if you can help me find a more accurate title.
here is what i have in my bashrc:
export currdate=`date | awk '{print $2$3}'`
loggit (){
$0 2>&1 | tee /tmp/$currdate.logs
}
bassically i want to log the output when i run myscript.sh like this:
bash$: myscript.sh 2>&1 | tee /tmp/todaydate.logs
but i dont want to do that everytime, what i want is
bash$: myscript.sh loggit
I dont know how to do this when the function goes after an argument so Could you help please?
UPDATE
Fixed by doing this:
loggit (){
$1 2>&1 | tee /tmp/$currdate.logs
}
and do: (thanks to tripleee)
bash$: loggit myscript.sh
UPDATE
Fixed by doing this:
and do: (thanks to tripleee)