i'm trying to write a 'live git log' bash script. here's the code so far:
#!/bin/sh
while true;
do
clear
git log --graph -10 --all --color --date=short --pretty=format:"%Cred%x09%h %Creset%ad%Cblue%d %Creset %s %C(bold)(%an)%Creset"
sleep 3
done
my problem is that git log uses a pager and you have to press q to quit or it will just sit there forever. is there a way to code the quit command in bash? i tried echoing q, with no luck. (i saw another post here that suggested echo "q" > /dev/console -- but there is no dev console in my environment)
system: win7 box - emulating bash with mingw (1.7.6.msysget.0)
UPDATE
here's the finished script
#!/bin/sh
while true;
do
clear
git log \
--graph \
--all \
--color \
--date=short \
-40 \
--pretty=format:"%C(yellow)%h%x20%C(white)%cd%C(green)%d%C(reset)%x20%s%x20%C(bold)(%an)%Creset" |
cat -
sleep 15
done
the -40 is a personal taste. change it to whatever number suits you and your terminal screen size.
| cat -
– Unexacting