{"id":13836197,"url":"https://github.com/kalpishs/Unix-Shell-Implementation-in-C","last_synced_at":"2025-07-10T13:32:08.772Z","repository":{"id":65743188,"uuid":"58267047","full_name":"kalpishs/Unix-Shell-Implementation-in-C","owner":"kalpishs","description":"Simulate the Working of Command Line Interface in Unix-like Environment.                                                                            Implemented Piping, redirection, history, environment variables,external-internal commands etc using family of system calls.","archived":false,"fork":false,"pushed_at":"2016-06-17T18:28:14.000Z","size":125,"stargazers_count":25,"open_issues_count":0,"forks_count":20,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-02-17T06:36:12.470Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kalpishs.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-05-07T13:26:00.000Z","updated_at":"2023-10-29T17:20:00.000Z","dependencies_parsed_at":"2023-02-07T16:35:11.050Z","dependency_job_id":null,"html_url":"https://github.com/kalpishs/Unix-Shell-Implementation-in-C","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kalpishs/Unix-Shell-Implementation-in-C","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kalpishs%2FUnix-Shell-Implementation-in-C","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kalpishs%2FUnix-Shell-Implementation-in-C/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kalpishs%2FUnix-Shell-Implementation-in-C/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kalpishs%2FUnix-Shell-Implementation-in-C/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kalpishs","download_url":"https://codeload.github.com/kalpishs/Unix-Shell-Implementation-in-C/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kalpishs%2FUnix-Shell-Implementation-in-C/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264585372,"owners_count":23632646,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-04T15:00:38.319Z","updated_at":"2025-07-10T13:32:07.043Z","avatar_url":"https://github.com/kalpishs.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"===========================================================================================================================\n                     UNIX SHELL IMPLEMENTATION IN C\n=========================================================================================================================== \nThis program simulates the working of command line interface in Unix-like environment. Implemented Functionalities are as under:\n\n1. Execute all the External commands (ls, clear, vi etc.)\n\n2. Implement Internal commands: cd, pwd\n\n3. Initialize and use environment variables\n\n4. Print environment variables using echo command\n\n5. Redirection operators: STDIN, STDOUT, STDERR (\u003e\u003e,\u003e,\u003c\u003c,\u003c,2\u003e) \n\n6. Support for history command and '!' operator (history, !!, !-1, !10,!-10 etc)\n\n7. Pipes “|” (multiple) (Ex: ls | grep 'a' | wc)\n\n\n===========================================================================================================================\n                          Input/Output Format\n===========================================================================================================================\n\nInput from the 'stdin' in an infinite loop till an “exit” is entered.\nThe corresponding output should be printed to 'stdout'.\n\nEx:\nassume that PWD==home/user\n\nShell name: My_Shell\n\nbash prompt:~$ ./a.out\n\nMy_Shell:/home/user$ ls\n\nshell.c history.txt a.out\n\nMy_Shell:/home/user$ gfhj\n\ngfhj: command not found\n\nMy_Shell:/home/user$ exit\n\nBye...\n\nbash prompt:~$\n\n\n===========================================================================================================================\n                         Implementation Details\n=========================================================================================================================== \n\nThe shell.c contains the main function which takes the input from user and checks it for pipeline. If pipeline exist it processes the data separately else it passes the data to the functions. \n\nint with_pipe_execute():\nThis function is the initial function which is called for checking the all the command after initial preprocessing . It passes the processed output to function split\n\nint split(char *cmd_exec, int input, int first, int last):\n\nThis function is responsible for splitting of command and passing it to command function\n\n\nstatic int command(int input, int first, int last, char *cmd_exec):\n\nthis does the major part of the program. It  checks for various possibilities of commands. The types of commands that are checked are as under:\n\n1) Internal commands: pwd and cd\n\n2) echo commands, setting and getting environment variables\n\n3) redirection handler \n\n4) PIPE\n\n5) External commands\n\nit make use of various funtions like tokenise_redirect_input_output,tokenise_redirect_input,tokenise_redirect_output which internally calls tokenise_commands() for tokenization\n\n\nHelper functions:\ngetcwd():\n\ngets the current woring Directory\n\nsignal():\n\nHandle Interrupt Signal\n\nvoid prompt():\n\ninitiates new Promt \n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkalpishs%2FUnix-Shell-Implementation-in-C","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkalpishs%2FUnix-Shell-Implementation-in-C","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkalpishs%2FUnix-Shell-Implementation-in-C/lists"}