Hello Alex!
Well I don't know how to setup a script as you described it, but I know,
that there is jackctl.py. This i a text based python script for managing jack
and ALSA connections. I think it should be able to connect JACK MIDI ports as
well. It offers a shell just like Nama or Ecasound and has only one letter
commands. Ports are addressed by numbers (as they appear in the list of
jackctl.py).
Hope that helps.
Kindly yours
Julien
--------
Music was my first love and it will be my last (John Miles)
======== FIND MY WEB-PROJECT AT: ========
http://ltsb.sourceforge.net
the Linux TextBased Studio guide
======= AND MY PERSONAL PAGES AT: =======
http://www.juliencoder.de