Skip to content

shinraxtensei/MYSHELL

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MYSHELL "as beautiful as a shell"

This project is a custom shell implementation written in C that can handle most of the commands that bash can. It supports piping and redirection, environment variables, signal handling, and more.

Features

  • Run any command that can be run in bash
  • Handle piping and redirection of input and output
  • Manage environment variables
  • Handle signals like SIGINT (Ctrl-C) and SIGTSTP (Ctrl-Z)
  • Use terminal capabilities to display colored output and navigate through command history
  • Autocomplete commands using the tab key
  • Run commands in the background using the "&" symbol

Getting Started

To get started with this project, clone the repository to your local machine and navigate to the project directory. Compile the code by running the make command in the terminal.

Once the code is compiled, run the shell executable using the following command:

$ ./shell

This will start the shell and you can start entering commands.

Usage

This shell works just like any other shell. You can run any command that can be run in bash, including pipes and redirection.

Piping

To pipe the output of one command to another, use the "|" symbol. For example, to list all the files in the current directory and then sort them alphabetically, you can use the following command:

$ ls -la | sort

Redirection

To redirect the output of a command to a file, use the ">" symbol. For example, to save the output of the "ls" command to a file called "files.txt", you can use the following command:

$ ls > files.txt

To append the output of a command to a file, use the ">>" symbol. For example, to append the output of the "ls" command to a file called "files.txt", you can use the following command:

$ ls >> files.txt

Environment Variables

To set an environment variable, use the "export" command. For example, to set the variable "MYVAR" to the value "hello", you can use the following command:

$ export MYVAR=hello

To see a list of all environment variables, use the "env" command. For example:

$ env

Signal Handling

This shell handles signals like SIGINT (Ctrl-C) and SIGTSTP (Ctrl-Z). To interrupt a running command, press Ctrl-C. To pause a running command, press Ctrl-Z.

Autocomplete

To autocomplete commands, press the tab key. The shell will attempt to complete the command based on the characters you've typed so far.

Background Commands

To run a command in the background, use the "&" symbol at the end of the command. For example:

$ sleep 10 &

This will run the "sleep 10" command in the background, allowing you to continue entering commands in the shell.

Contributing

If you have any ideas for new features or improvements to existing ones, feel free to submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

as beautiful as a shell

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published