diff --git a/commands/cat.php b/commands/cat.php
index 5f77575..72ce93a 100644
--- a/commands/cat.php
+++ b/commands/cat.php
@@ -1,5 +1,5 @@
2) {
diff --git a/commands/cd.php b/commands/cd.php
index f522b57..8abab13 100644
--- a/commands/cd.php
+++ b/commands/cd.php
@@ -1,5 +1,5 @@
2) {
file_put_contents("recent.txt", "Invalid number of arguments.
", FILE_APPEND);
diff --git a/commands/clear.php b/commands/clear.php
index d7b030d..cd81c0a 100644
--- a/commands/clear.php
+++ b/commands/clear.php
@@ -1,5 +1,5 @@
.txt
-edit terminal.php
\ No newline at end of file
+write php
+write help.txt .txt
\ No newline at end of file
diff --git a/terminal.php b/terminal.php
index 7ffa641..faf73b9 100644
--- a/terminal.php
+++ b/terminal.php
@@ -40,37 +40,14 @@ if (!opendir("fileroot")) {
echo "";
exit(0);
}
- if ($commands[0] == "pwd") {
- include "commands/pwd.php";
- pwd($commands);
- } else if ($commands[0] == "mkdir") {
- include "commands/mkdir.php";
- mdir($commands);
- } else if ($commands[0] == "rm") {
- include "commands/rm.php";
- rm($commands);
- } else if ($commands[0] == "clear") {
- include "commands/clear.php";
- clear($commands);
- } else if ($commands[0] == "cd") {
- include "commands/cd.php";
- cd($commands);
- } else if ($commands[0] == "help") {
- include "commands/help.php";
- help($commands);
- } else if ($commands[0] == "touch") {
- include "commands/touch.php";
- touc($commands);
- } else if ($commands[0] == "cat") {
- include "commands/cat.php";
- cat($commands);
- } else if ($commands[0] == "ls") {
- include "commands/ls.php";
- ls($commands);
- } else {
+ if(file_get_contents("commands/$commands[0].php") != NULL){
+ include "commands/$commands[0].php";
+ func($commands);
+ }
+ else{
file_put_contents("recent.txt", "Unknown command.
try 'help' or 'help [command]'
", FILE_APPEND);
}
- echo "";
+ echo "";
?>