def main(): file_to_add = "" cmd = "git status | sed -n '/Untracked/,$ s/#\t// p'" ## parse command line options and arguments (options, args) = parseCmd() # print options # print args ## split into lines # myline = re.split('\n', out) myline = execBash.execBash(cmd).splitlines() ## iterate through to add wanted file for my_file in myline[3:]: # print line # my_file = line.lstrip('# \t') # print my_file ## add file if options.add_all: file_to_add = file_to_add + " " + my_file else: # interactive mode (default) input = raw_input("you want to add " + my_file + " (y/n): ") if input == "y": file_to_add = file_to_add + " " + my_file # print file_to_add if file_to_add != "": ## execute bash command out = execBash.execBash("git add" + file_to_add) print out
def main(): adb_cmd = None (options, args) = parseCmd() #print execBash('echo "testing"') #print execBash('echo "testing"')[0] if len(args)!=2: print usage sys.exit(2) if options.adb_cmd: print "options.adb_cmd: ", options.adb_cmd adb_cmd = options.adb_cmd else: adb_cmd = "adb pull /system/conti/dcm/data/Probe-ttprb00017-%08d.bin.gz" #adb_cmd = "echo Probe-ttprb00017-%08d.bin.gz" print "adb_cmd: ", adb_cmd start = int(args[0]) end = int(args[1]) print "start-sequence: ", start, "; end-sequence: ", end while(end >= start): sh_adb_cmd = adb_cmd % end #print "sh_adb_cmd: ", sh_adb_cmd execBash(sh_adb_cmd, False, True) end -= 1
def main(): (options, args) = parseCmd() for i in range(50): if execBash('export DISPLAY=localhost:%d && xclock'% (i,))[1] ==0: #if execBash('xclock')[1]==0: print("export DISPLAY=localhost:%d" % i) execBash ('export DISPLAY=localhost:%d' % i) sys.exit(0)
def main(): (options, args) = parseCmd() print execBash('echo "testing"') print execBash('echo "testing"')[0]