Module spug.util.shell

Utilities to make it easy to do in python what you can easily do in bash.

Classes

Functions

ctime(file)

def ctime(file): 

Returns the creation time of the file

mtime(file)

def mtime(file): 

Returns the modification time of the file

atime(file)

def atime(file): 

Returns the last access time of the file

fmttime(fstr, timeval)

def fmttime(fstr, timeval):

Formats a unix timeval (seconds since the epoch) as a string according to the rules defined by the format string fstr.

fstr follows the same formatting conventions as strftime. Time zone is always assumed to be the local timezone.

nt(file0, file1)

def nt(file0, file1): 

Returns true if file0 is newer than file1, returns false if either file doesn't exist or file1 is newer or has the same mtime.

ot(file0, file1)

def ot(file0, file1): 

Returns true if file0 is older than file1, returns false if either file doesn't exist or file1 is newer or has the same mtime.

xl(str, pat)

def xl(str, pat):

Deletes the leading substring that matches the pattern pat. pat can contain shell wildcards "*" and "?".

XXX at this time, pattern matching has a problem with other regular expression metacharacters. They will be used as the would in a regular expression.

xt(str, pat)

def xt(str, pat):

Deletes the trailing substring that matches the pattern pat. pat can contain shell wildcards "*" and "?".

XXX at this time, pattern matching has a problem with other regular expression metacharacters. They will be used as the would in a regular expression.