// md: target should be a series of blank-delimited directories to be created
//     If an element is a whildcard, the directory will always be created,
//     using mkdir -p.
//
//     uses: run()

void md(string target)
{
    int idx;
    list paths;
    string dir;

    paths = strtok(target, " ");

    for (idx = sizeof(paths); idx--; )
    {
        dir = paths[idx];
        if (!exists(dir))
        {
            run("mkdir -p " + dir);
            echo(OFF);
            target = `"realpath " + dir`[0];
            echo(ON);
            target = substr(target, 0, strlen(target) - 1);
            g_log += (list)("dir " + target);   // log new dirs
        }
    }
}
