Command line inputs are in sys.argv. Try this in your script: import sys print (sys.argv) There are two modules for parsing command line options: optparse (deprecated since Python 2.7, use argparse instead) and getopt. If you just want to input files to your script, behold the power of fileinput. The Python library reference is your friend. Automating Task and Using Command Line Argument; ENTRY PROFILE. Undergraduates , Graduates ; Working Professionals; Anyone who wishes to be a Python Coder; EXIT PROFILE & JOB OPPORTUNITIES. Python programmer; APPLY NOW. Related Courses. Free. Certificate in BlockChain. biocard. DURATION 50 Hours WHAT YOU WILL LEARN BlockChain 101 Decentralization Symmetic Cryptography Public Key Cryptography ... I have a text file named abd shown below. 48878 188.8.131.52 34782 184.108.40.206 12817 220.127.116.11 I want to extract only IP address from the text and store it in a variable and use for other .mysql-simple-output.sh: The title of this script is a little misleading, since I meant to use it for a different purpose, but essentially this script allows you to log into the MySQL Command Line Client from any location in your computer. I created it because I kept forgetting the correct file paths from where I could login, so this proved very helpful. The shell command and any arguments to that command appear as numbered shell variables: $0 has the string value of the command itself, something like script, ./script, /home/user/bin/script or whatever. Any arguments appear as "$1", "$2", "$3" and so on. The count of arguments is in the shell variable "$#".. Common ways of dealing with this involve shell commands getopts and shift.
[index]