Skip to content

Latest commit

 

History

History
36 lines (29 loc) · 1.87 KB

README.md

File metadata and controls

36 lines (29 loc) · 1.87 KB

KingShell

This is just a program which I made in my class, to simulate a linux Shell;

Commands (Built-In)

  • help -> It shows a list of built-in commands on standard output;
  • sair/exit/quit NUMBER -> It shutdowns the program after X seconds (if you just write "quit", it will be shutdown after 3 seconds;
  • cd -> It changes your current directory;
  • 42 -> It shows the explanation of number 42;
  • sols -> Shows the list of files and folders in the current directory;
  • aviso MESSAGE NUMBER -> Shows an warning message after NUMBER seconds;
  • avisoth MESSAGE NUMBER -> Shows an warning message after NUMBER seconds (by using threads);
  • PS1=NAME -> It changes the default prefix to a word that you want to choose (if you write {default} it will give the default prefix;
  • calc NUMBER OP NUMBER -> It calculates an operation between two real numbers;
  • bits NUMBER OP NUMBER -> It calculates a binary operation between two integer numbers;
  • quemsoueu -> It calls the system("id") function;
  • socp FILE1 FILE2 -> It copies the content of FILE1 to FILE2;
  • socpth FILE1 FILE2 -> It copies the content of FILE1 to FILE2 (using threads);
  • rocket -> It shows a rocket in the standard output (see https://helloacm.com/simple-cc-rocket-animation/ )
  • jpg (or jpeg) FILE1 -> It checks if FILE1 is a JPEG file;

Redirects, Pipes, Background/Foreground and Threads

This program also has redirect support for non-builtin commands (e.g: ls), also as Pipe and Backgroud executes support;

Supported Redirects:

  • Input (<);
  • Append Output (>>);
  • Output (>);
  • Error Output (2>);