PyShell is a simple, beginner-friendly shell for both shell and Python programming. This README file provides an overview of the PyShell code and how to use it effectively. It is designed to help beginners get started with shell and Python scripting in a user-friendly environment.
PyShell is a Python script that provides a command-line interface for executing shell commands and Python scripts. It allows you to navigate directories, view files, and run shell commands or Python scripts in a simple and interactive manner. It is designed with beginners in mind, making it an excellent tool for learning shell and Python programming.
- Simple and Interactive: PyShell provides a user-friendly interface for running shell commands and Python scripts, making it accessible to beginners.
- Directory Navigation: You can navigate directories using the
goto
command. - View Files: Use the
view
command to list files in the current directory. - Display File Contents: You can view the contents of a file using the
display
command. - Execute Shell Commands: Run shell commands directly from PyShell by entering the command.
- Execute Python Scripts: You can also run Python scripts from PyShell.
- Help: Get help with PyShell commands by using the
__help__
command.
To use PyShell, follow these steps:
- Ensure you have Python 3 installed on your system.
- Save the PyShell code to a Python file, e.g.,
pyshell.py
. - Open a terminal or command prompt.
- Navigate to the directory containing
pyshell.py
. - Run PyShell by executing
python pyshell.py
.
You should see the PyShell prompt, which looks like this:
$
You can now start using PyShell to run commands and scripts.
PyShell supports the following commands:
view
: List visible files and folders in the current directory.goto <directory>
: Change the current directory.display <file_path>
: View the contents of a file.current
: Display the current working directory.show_current
: Show current directory on start.hide_current
: Hide current directory on start.create_file <file_name>
: Create a new filecreate_folder <folder_name>
: Create a new folderedit <filename>
: Edit a file using basic text editor.view_all
: List all files and folders in the current directory.copy <source_file> <new_file>
: Copy a file/foldermove <source_file> <new_file>
: Move a file/folderdelete <source>
: Delete a file/folderdelete_folder <source>
: Delete a folder__help__
: Get help about PyShell.__exit__
: Exit PyShell.version
: Check version.<shell_command>
: Execute a shell command.
If you need help with PyShell commands, you can use the __help__
command to display the help text.
Example:
$ __help__
To exit PyShell, use the __exit__
command:
$ __exit__
Here's an example of commands in PyShell:
$ goto / $ current / $ show_current /$ hide_current $ view 'snap' 'srv' 'var' 'lib64' 'lib' 'tmp' 'bin' 'libx32' 'root' 'cdrom' 'run' 'sys' 'sbin' 'dev' 'opt' 'boot' 'lost+found' 'media' 'swapfile' 'lib32' 'etc' 'home' 'mnt' 'proc' 'usr' $ goto home $ view 'root' 'cmard' $ goto cmard $ create_folder test $ goto test $ view $ create_file test.sh $ edit test.sh $ # wrote -> echo 'Hello, World!' Invalid command: # wrote -> echo 'Hello, World!' $ bash test.sh $ Hello, World! $ __exit__
You can also use PyShell as a module and create your own python script with it:
If you'd like to contribute to PyShell or report issues, please feel free to create an issue or submit a pull request. Your contributions are welcome and appreciated.
This project is licensed under the MIT License - see the LICENSE file for details.