Let's say that I have a command git branch
(always with a couple of words) for example.
What I want is to keep track of when this command is executed with arguments. For example, if I execute the command git branch develop
without errors, I want to save develop
on a file.
I tried to overwrite git command on my .bash_profile
, something like this:
git () {
if [ $# -eq 3 ]
then
git $@
echo $2 > /path/tacked_parameters.txt
else
git $@
fi
}
But seems that does not work well. Is there any way to do this?