Git Product home page Git Product logo

agri-shell-code-in-c's Introduction

Agri-Shell-Code-In-C

#include <stdio.h>
#include <stdlib.h>

void 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);
}

agri-shell-code-in-c's People

Contributors

ahmadjajja avatar

Stargazers

mohsin raza abid avatar Muhammad Usman Ghani avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.