I want to make a CLI using bash for fun. I want to have a read prompt like
CLI/[path]/:>
easy
read -p "CLI$PWD/:>"
but if I want to do a command like cd
then I will have to make a whole interface to change the directory. I know how to do all of the other basic commands, but my main goal is to be able to switch my directory in one command.
EG:
CLI/[path]/:>cd [another path]
CLI/[another path]/:>
My script so far:
#!/bin/bash
echo "Welcome to Easy Command-Line Interface! Type 'help' for help and
commands."
while true; do
read -p "ECLI$PWD/:>"
if [ $REPLY = "help" ]; then
echo "ECLI HELP:"
echo "help: Help Menu"
echo "cd: <dir> : Changes Directory"
echo "say: <text> : Prints <text>"
echo "exit: Exits ECLI"
echo "clear: Clears screen"
echo "
"
fi
if [ $REPLY = "exit" ]; then
echo "Exiting ECLI.."
sleep 1.5
clear
break
fi
if [ $REPLY = "clear" ]; then
clear
fi
done