https://github.com/ahmadjajja/agri-shell-code-in-c
https://github.com/ahmadjajja/agri-shell-code-in-c
Last synced: 7 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ahmadjajja/agri-shell-code-in-c
- Owner: Ahmadjajja
- Created: 2023-01-15T22:57:57.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-26T09:28:53.000Z (over 2 years ago)
- Last Synced: 2025-01-21T21:34:09.473Z (9 months ago)
- Size: 5.86 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Agri-Shell-Code-In-C
```c
#include
#includevoid welcome();
void options();
void user();
void date();
void ip();
void list();
void path();
void newfolder();
int main()
{
welcome();
options();
char choice = '0';while(choice != '9'){
if(choice != '\n')
printf("Aneebs's Shell#: ");
scanf("%c",&choice);if(choice == '0')
options();
else if(choice == '1')
user();
else if(choice == '2')
date();
else if(choice == '3')
ip();
else if(choice == '4')
list();
else if(choice == '5')
path();
else if(choice == '6')
newfolder();
else if(choice == '9')
exit(0);if(choice != '\n')
printf("\n");}
return 0;
}void welcome()
{
printf(" # \n");
printf(" ## ## \n");
printf(" ### ### \n");
printf(" ### ### \n");
printf(" ### ### \n");
printf(" ############### \n");
printf(" ### ### \n");
printf(" ### ### \n");
printf(" ### ### #\n");
printf(" ### ### ####\n");
printf(" ### ##hmad Jajja's ## ##gri Shell\n");
printf("Type command number to execute commands that are given below...\n");}
void options()
{
printf("\nCommands to execute...\n\n");
printf("0. OPTIONS\n");
printf("1. Check current username\n");
printf("2. Check current date and time\n");
printf("3. Check ip address of the machine\n");
printf("4. List content of current directory\n");
printf("5. Check current working directory path\n");
printf("6. Create new folder\n");
printf("9. Exit\n\n");}
void user()
{
printf("\n");
system("whoami");}
void date()
{
printf("\n");
system("date");}
void ip()
{
printf("\n");
system("ip route");}
void list()
{
printf("\n");
system("ls");
}void path()
{
printf("\n");
system("pwd");
}void newfolder()
{
printf("\nEnter new folder name: ");
char foldername[30];
scanf("%s", foldername);
char command[40];
snprintf(command, sizeof command, "mkdir %s", foldername);
system(command);
}
```