A shell written in C, inspired by Bash.
- Parsing, expansion, and command execution
- Pipes and redirections
- Signal handling
- Environment variables
- Builtin commands:
cd,echo,env,exit,export,pwd,unset
# input redirection
cat < infile
# output redirection
echo hello > outfile
# output redirection (append)
echo world >> outfile
# pipe
env | grep PATH
# heredoc
cat << EOF
line 1
line 2
EOF# go home
cd
# go to path
cd /tmp# print environment variable
echo $HOME
# no newline
echo -n hello# print exported variables (sorted)
export
# set variable
export USERNAME=jerome
# create key without value
export EMPTY_KEY
# check exported value
env | grep USERNAME# print set environment variables
env# print working directory
pwdexport TEST_VAR=42
env | grep TEST_VAR
# unset variable
unset TEST_VAR
env | grep TEST_VAR# exit minishell
exit
# exit with code
exit 42- OS: Linux or macOS
- make
- cc
- readline (macOS:
brew install readline) - valgrind (for
make valgrind)
# compile
make
# launch shell
./minishellmake # compile
make clean # remove objects
make fclean # remove objects and executable
make re # clean and recompile
make valgrind # run valgrind