A linux-like shell
Project description
PY_3
Implementation of simple UNIX like shell using Python.
Main module is commands.py and for running the shell using the command
python commands.py
All commands are implemented as separated modules which are present in different files with the filename same as the name of the command.
SUPPORTED COMMANDS
-
Directory related commands
ls
: list directory contentsmkdir
: make directoriespwd
: return working directory namermdir
: remove directoriescd
: change current working directory
-
FileDirectory related commands
cat
: concatenate and print filescp
: copy filesrm
: remove directory linksmv
: move filesgrep
: file pattern searcherhead
: display first lines of a filetail
: display the last part of a filesizeof
: size of filefind
: walk a file hierarchy
-
Built-in commands
date
: display date or timewhoami
: display effective user idhostname
: print hostname of current host systemtimeit
: measures execution timeexit
: terminate the shellhistory
: previous commands
-
Ctrl-C
signal handling
Unittest
Unittest module is used for testing for the entire shell. The unittest unit testing framework was originally inspired by JUnit and has a similar flavor as major unit testing frameworks in other languages. test_file.py has test for the modules in it.
Example:
pragyas-mbp-2:PY_3 pragkuma$ python test_file.py
----------------------------------------------------------------------
Ran 22 tests in 0.112s
OK
Input/Output Format
Input from the 'stdin' in an infinite loop till an “exit” is entered. The corresponding output should be printed to 'stdout'.
Example:
pragyas-mbp-2:PY_3 pragkuma$ python commands.py
MyShell> find . -name grep
./grep
MyShell> date -u
Mon Aug 5 09:14:11 UTC 2019
MyShell> whoami
pragkuma
MyShell> sizeof hostname.py
2278 bytes
MyShell> exit
exiting prompt
Help/Usage of command
Write the name of the command followed by --help in order to get the usage of the command.
Example:
MyShell> find --help
usage:
NAME
find -- walk a file hierarchy
DESCRIPTION
The find utility recursively descends the directory tree for each path listed,
evaluating an expression (composed of the ``primaries'' and ``operands'' listed below)
in terms of each file in the tree.
[-h] [-name NAME] [args [args ...]]
positional arguments:
args enter the filenames
optional arguments:
-h, --help show this help message and exit
-name NAME, --name NAME
expression determines what to find
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file Adobe_cli-0.1-py2-none-any.whl
.
File metadata
- Download URL: Adobe_cli-0.1-py2-none-any.whl
- Upload date:
- Size: 3.4 kB
- Tags: Python 2
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/2.7.16
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 251f6be3692ea12cf3f3a42c12b443855f0a380f33c2d9b3de69d86d1a32abf2 |
|
MD5 | d2f6ea7118441ee2fc37562e2c78c710 |
|
BLAKE2b-256 | 9ab920263298d588874016661dc38cad743cba4c8281ebf4e2d1919fbea15303 |