Last active
August 28, 2017 07:54
-
-
Save rubencaro/75e7b163665b47e0094a to your computer and use it in GitHub Desktop.
DOT auto render script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function get_mtime { | |
ls -l --time-style=+%s "${1?}" | cut -d' ' -f6 | |
} | |
function go_render { | |
dotfile="$1" | |
mtime=0 | |
while true; | |
do | |
newtime=$(get_mtime "$dotfile") | |
test $mtime -ne $newtime && dot -O -Tpng $dotfile; | |
mtime=$newtime | |
sleep 1; | |
done; | |
} | |
go_render myfile.dot & |
Mac version of go_render
:
function go_render {
dotfile="$1"
mtime=0
while true;
do
newtime=$(get_mtime "$dotfile")
test $mtime != $newtime && dot -O -Tpng $dotfile;
mtime=$newtime
sleep 1;
done;
}
NO TODOS LOS MAC SON IGUALES!!!
function get_mtime {
ls -l -T "${1?}" | cut -d' ' -f10
}
Mi comentario anterior lo escribió Rubén Caro
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Mac version of get_mtime: