Generally, the operating system's shell starts applications with several pieces of information that constitute the OS API:
- The shell provides each application with its collection of environment variables. In Python, these are accessed through os.environ.
- The shell prepares three standard files. In Python, these are mapped to sys.stdin, sys.stdout, and sys.stderr. There are some other modules, such as fileinput, that can provide access to sys.stdin.
- The command line is parsed by the shell into words. Parts of the command line are available in sys.argv. For POSIX operating systems, the shell may replace shell environment variables and glob wildcard filenames. In Windows, the simple cmd.exe shell will not glob filenames for us.
- The OS also maintains context settings, such as the current working directory, user identity, and user group information...