



Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!




d o n 't fo rg e t a b o u t re d ire c t io n
I kn o w t h is !""It 's a UNIX s ys t e m! I kn o w t h is !"
Xec="C_Xec"Xec="C_Xec" forfor DataData inin Input_;Input_; dodo printprint "Running"Running ${Xec}${Xec} withwith ${Data}"${Data}" rmrm -f-f corecore ${Xec}${Xec} << ${Data}${Data} 2>&12>& ifif (((( $?$? !=!= 00 )))) |||| [[[[ -f-f corecore ]];]]; thenthen printprint "File:"File: ${Xec}${Xec} failedfailed withwith ${Data}"${Data}" fifi donedone 2>&12>&
Xec="C_Xec"Xec="C_Xec" forfor DataData inin Input_;Input_; dodo printprint "Running"Running ${Xec}${Xec} withwith ${Data}"${Data}" rmrm -f-f corecore Output=$(${Xec}Output=$(${Xec} << ${Data}${Data} 2>&1)2>&1) ifif (((( $?$? !=!= 00 )))) |||| [[[[ -f-f corecore ]];]]; thenthen printprint "File:"File: ${Xec}${Xec} failedfailed withwith ${Data}"${Data}" fifi printprint^ ${Output}${Output} donedone 2>&12>&
import stringimport string import commandsimport commands import osimport os Xec = "Some_C_a.out"Xec = "Some_C_a.out" Input_List = commands.getoutput("ls Input_").split()Input_List = commands.getoutput("ls Input_").split() for Data in Input_List:for Data in Input_List: print "Running", Xec, "with", Dataprint "Running", Xec, "with", Data os.system("rm -f core")os.system("rm -f core") [Status, Output] = commands.getstatusoutput([Status, Output] = commands.getstatusoutput( Xec + " < " + Data)Xec + " < " + Data) if (Status != 0) or (os.access("core", 0)):if (Status != 0) or (os.access("core", 0)): print "File:", Xec, "failed with", Dataprint "File:", Xec, "failed with", Data print Outputprint Output
#! /bin/ksh#! /bin/ksh PS3="Select a food item: "PS3="Select a food item: " select Item in Burger Fries Shake Quit; doselect Item in Burger Fries Shake Quit; do printprint case ${REPLY} incase ${REPLY} in
#! /usr/bin/env python#! /usr/bin/env python import sysimport sys Items=("Burger", "Fries", "Shake", "Quit")Items=("Burger", "Fries", "Shake", "Quit") Reply = NoneReply = None while Reply == None:while Reply == None: printprint for I in range(1, len(Items)+1):for I in range(1, len(Items)+1): print "%d) %s" % (I, Items[I-1])print "%d) %s" % (I, Items[I-1]) print "Select a food item: ",print "Select a food item: ", Reply = sys.stdin.readline().strip()Reply = sys.stdin.readline().strip() try:try: Reply = int(Reply)Reply = int(Reply) except ValueError:except ValueError: printprint print "Invalid entry!"print "Invalid entry!" Reply = NoneReply = None else:else: printprint if (Reply < 0) orif (Reply < 0) or (Reply > len(Items)):(Reply > len(Items)): print "Invalid entry!"print "Invalid entry!" Reply = NoneReply = None elif Reply == 1: elif Reply == 1: print "That will be $500.00"print "That will be $500.00" Reply = NoneReply = None elif Reply == 2: elif Reply == 2: print "That will be $10.00"print "That will be $10.00" Reply = NoneReply = None elif Reply == 3: elif Reply == 3: print "That will be $80.00"print "That will be $80.00" Reply = NoneReply = None else: else: print "You made theprint "You made the right choice!"right choice!" passpass sys.exit(0) sys.exit(0)
On e la s t lit t le fu n s c rip t