customized_shell
is a simple command-line shell implemented in Go. It supports basic built-in commands like cd
, echo
, pwd
, type
, and exit
, as well as executing external commands available in the system's PATH
.
- Built-in commands:
cd
,echo
,pwd
,type
, andexit
- Executes external commands found in the system's
PATH
- Handles user input interactively
- Provides error messages for invalid commands and arguments
-
Clone the repository:
git clone https://github.com/yourusername/customized_shell.git cd customized_shell
-
Build and run the shell using the provided script:
./customized_shell.sh
- cd [directory]: Change the current directory to the specified directory. Use
~
to navigate to the home directory. - echo [args...]: Print the arguments to the standard output.
- pwd: Print the current working directory.
- type [command]: Display whether the command is a shell builtin or an external command, and show the path for external commands.
- exit [0]: Exit the shell. Only
exit 0
is considered a valid exit command.
$ cd ~
$ pwd
/home/user
$ echo Hello, World!
Hello, World!
$ type cd
cd is a shell builtin
$ ls -l
total 8
drwxr-xr-x 2 user user 4096 Jun 18 15:07 cmd
drwxr-xr-x 2 user user 4096 Jun 18 15:07 internal
-rwxr-xr-x 1 user user 102 Jun 18 15:07 customized_shell.sh
-rw-r--r-- 1 user user 258 Jun 18 15:07 go.mod
$ exit 0
- Go 1.16 or later
To build the project from source without using the provided script:
cd cmd
go build -o ../customized_shell
../customized_shell
To run the automated tests, use the following command:
go test ./...
To see test coverage, use:
go test -cover ./...
By adding automated tests, you can ensure that your code behaves as expected and catch any regressions early in the development process.
Contributions are welcome! Please open an issue or submit a pull request with any improvements or bug fixes.