pastebin - collaborative debugging tool
python.kpaste.net RSS


IfNotFoundDo
Posted by Anonymous on Fri 30th Apr 2021 01:19
raw | new post
modification of post by Anonymous (view diff)

  1. #!/usr/bin/python3
  2. import sys
  3. import os.path
  4.  
  5. def easyOptionsArgs(lookingFor,theArgs):
  6.     n = len(theArgs)
  7.     theValue=""
  8.     for i in range(1, n):
  9.         if (sys.argv[i].startswith(lookingFor)):
  10.             theValue=sys.argv[i].split("=")
  11.             return theValue[1:][0]
  12.     return theValue
  13.  
  14.  
  15. #inFile = easyOptionsArgs("-f",sys.argv)
  16. outFile = easyOptionsArgs("-o",sys.argv)
  17. commandEh = easyOptionsArgs("-c",sys.argv)
  18.  
  19. #print("inFile",inFile)
  20. print("outFile",outFile)
  21. print("commandEh",commandEh)
  22.  
  23.  
  24. for line in sys.stdin:
  25.     line = line.strip()
  26.     print("#" + line )
  27.     newFile = line + outFile
  28.     if os.path.isfile(newFile) is False:
  29.         newCommand=commandEh.replace("%1",line)
  30.         newCommand=newCommand.replace("%2",newFile)
  31.        
  32.         print(newCommand)

Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.

Syntax highlighting:

To highlight particular lines, prefix each line with {%HIGHLIGHT}




All content is user-submitted.
The administrators of this site (kpaste.net) are not responsible for their content.
Abuse reports should be emailed to us at