Ejemplo n.º 1
0
    print usage
    exit(1)


for opt, arg in opts:
    if opt in ('-c', '--class'):
        course = arg
    if opt in ('-t', '--term'):
        term = arg

if(len(remainder) != 0 or len(opts) != 2):
    print("{}: improper number of arguments".format(prog))
    print usage
    exit(1)

home_dir = os.environ['HOME']
class_dir = "{}/{}/{}".format(home_dir, term, course)

for folder in ['assignments', 'examples', 'exams',
               'lecture_notes', 'submissions']:
    fsutils.create_dirs(1, "{}/{}".format(class_dir, folder))

fsutils.create_link(1, "/usr/local/classes/eecs/{}/{}/src/README"
                    .format(term, course),
                    "{}/README"
                    .format(class_dir))
fsutils.create_link(1, "/usr/local/classes/eecs/{}/{}/src"
                    .format(term, course),
                    "{}/src_class"
                    .format(class_dir))
Ejemplo n.º 2
0
#  Initial revision
#

import sys
import getopt
import fsutils

prog = sys.argv[0]
usage = 'USAGE: ln.py [-s | --symbolic] TARGET LINK_NAME'
symbolic = False

try:
    opts, remainder = getopt.gnu_getopt(sys.argv[1:], 's', ['symbolic'])
except getopt.GetoptError as err:
    print("{}: {}".format(prog, err.msg))
    print usage
    exit(1)

for opt, arg in opts:
    if opt in ('-s', '--symbolic'):
        symbolic = True

if(len(remainder) == 2):
    target, link = remainder
else:
    print("{}: improper number of arguments".format(prog))
    print usage
    exit(1)

fsutils.create_link(symbolic, target, link)