Skip to content

Latest commit

 

History

History
27 lines (21 loc) · 540 Bytes

File metadata and controls

27 lines (21 loc) · 540 Bytes

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