MSH is a minimalistic shell implementation that provides a basic command-line interface with enhanced features. This README outlines the various functionalities supported by MSH.
- MSH (Minimal Shell)
The cd
command is built into MSH, allowing users to change the current working directory. Simply enter cd [directory]
to navigate to the specified directory. If [directory]
is omitted, the current user's $HOME
directory is used. This cd
also handles the -
argument that's passed to the cd
command. For example, when
the command is cd -
, the shell changes directory to the value of $OLDPWD
, which is the last directory the user
visited before their current working directory.
MSH supports aliasing commands for convenience using the alias
command and removing aliases with unalias
. This enables users to create shorthand notations for commonly used commands.
alias cls='clear'
alias md=mkdir
# Improved usage
alias ls="ls --color=auto" ping="ping -c 5"
alias memchk='valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes -s'
alias flush_dns_cache=""
alias lsfwrules='sudo iptables -nv --line-numbers -L '
.
.
.
alias flush_dns_cache='resolvectl flush-caches'
alias l1="ls -1"
alias grep='grep --color=auto'
unalias cls # remove the 'cls' alias
Logical operators &&
(AND) and ||
(OR) are supported in MSH. They enable users to execute commands conditionally based on the success or failure of previous commands.
command1 && command2
command1 || command3
MSH allows the execution of system commands. Enter any system command directly in the shell prompt to run it.
ls -a
cat /etc/passwd
mkdir src
The exit
command, built into MSH, is used to exit the shell gracefully. It takes positive exit codes
exit
exit 1 # exit with status code 1
The setenv
and unsetenv
commands are utilized to set and unset environment variables, respectively. This feature enhances the customization of the shell environment.
setenv MY_VARIABLE my_value
unsetenv MY_VARIABLE
MSH can take input from a file, allowing users to execute a series of commands from a script.
msh script.txt
Comments can be added to MSH using the #
symbol, allowing users to annotate their commands without affecting execution.
# This is a comment
echo "Hello, MSH!"
ls # this will list the contents in the current working directory
MSH supports variable expansion, including $$
(current process ID) and $?
(exit status of the last executed command).
echo "Process ID: $$"
command
echo "Exit Status: $?"
The semicolon (;
) acts as a command separator in MSH, allowing users to execute multiple commands on a single line.
command1 ; command2
Custom command env
is available to display the current environment variables.
env
MSH uses the PATH
environment variable to locate executable files. Ensure the desired directories are included in the PATH
for seamless command execution.
MSH supports commands with and without arguments, providing flexibility in command execution.
ls
ls -l
To download the latest release of MSH, click here.
For information on how to install and execute, please visit the wiki
Maxwell Nana Forson