U404-Shell is a simple shell program written in C.
It provides a command-line interface to interact with the file system and perform various operations.
- File operations: select, delete, create
- Directory operations: create
- System operations: list files and directories, print the current working directory, clear the screen
- Script execution: execute a sequence of commands from a script file
- Conditional execution: execute commands based on conditions
select-file <filename>
: Select a file for operations like delete.delete
: Delete the selected file.makefile <filename>
: Create a new file.makefolder <foldername>
: Create a new folder.ls
: List files and directories in the current directory.pwd
: Print the current working directory.clear
: Clear the screen.uprint <message>
: Print a Unicode string.help
: Show available commands.
In the U404-Shell, you can execute a script with conditional statements using the execute_script function. This function reads a script file line by line and executes each command. It also supports conditional execution of commands using if
, else
, and endif
statements.
- Create a script file with your commands. Each command should be on a new line. For conditional execution, you can use
if
,else
, andendif
statements. The if statement should be followed by a condition. Currently, the shell supports three conditions:file_exists
,is_greater
, andis_even
.
Example script (script.txt):
if file_exists test.txt
uprint File exists
else
uprint File does not exist
endif
2. In the shell, call the execute_script function with the name of your script file as the argument.
Example:
execute_script script.txt
This will execute the script, printing "File exists" if test.txt
exists, and "File does not exist" otherwise.
To build the program, use a C compiler like gcc
gcc main.c -o u404shell
To run the program: ./u404shell
To execute a script: ./u404shell script.txt
Contributions are welcome. Please submit a pull request or create an issue to discuss the changes.
U404-Shell is open-source software released under the MIT license.