#!/usr/bin/ensim-python

import os,sys
import ensimapplpath
import svcparser

if len(sys.argv) != 3:
    print 'Usage: %s <action> <svcfile>' % sys.argv[0]
    sys.exit(1)

parser = svcparser.SvcParser()

# no attempt to catch exceptions for now

hash = parser.svc_parse(sys.argv[2])
f = os.popen('bash', 'w')
f.write(hash[sys.argv[1]])
status = f.close()
if status:
    sys.exit(status >> 8)
