Skip to content

Instantly share code, notes, and snippets.

@rubencaro rubencaro/dot_render.sh
Last active Aug 28, 2017

Embed
What would you like to do?
DOT auto render script
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 &
@RemiVR

This comment has been minimized.

Copy link

commented Jul 14, 2017

Mac version of get_mtime:

function get_mtime {
  ls -l -T "${1?}" | cut -d' ' -f12
}
@RemiVR

This comment has been minimized.

Copy link

commented Jul 14, 2017

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;
}

@nfuste

This comment has been minimized.

Copy link

commented Aug 25, 2017

NO TODOS LOS MAC SON IGUALES!!!

function get_mtime {
  ls -l -T "${1?}" | cut -d' ' -f10
}
@nfuste

This comment has been minimized.

Copy link

commented Aug 28, 2017

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
You can’t perform that action at this time.