Skip to content

Zachary-Rude/Terminal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 

Repository files navigation

Terminal

This is a terminal, made using Bash.

This takes input from the user, with the terminal prompt text being ~$, and stores the command entered by the user in a variable called cmd.

Then, it uses the Bash eval command to a) evaluate the user's input string as a Bash command, and b) make it functional.

Source Code

#!/bin/bash

clear
while :
do
  read -p '~$ ' cmd
  if [ "$cmd" = "python" ]; then
    python2
  elif [ "$cmd" = "exit" ];then
    echo exit
    break
  else
    eval "$cmd"
  fi
done