{"id":17355922,"url":"https://github.com/johnnieshere/shell-program","last_synced_at":"2026-04-28T22:34:14.949Z","repository":{"id":245793744,"uuid":"810741250","full_name":"JohnniesHere/shell-program","owner":"JohnniesHere","description":"This is a simple shell program written in C for Linux-based machines. It reads commands from the user or a script file, executes them, and handles special commands like \"alias\", \"unalias\", and \"source\". It also counts the number of commands, script lines, and commands that contains quotes. It uses a stack to check for quotes in the input.","archived":false,"fork":false,"pushed_at":"2024-07-04T10:26:31.000Z","size":51,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T14:19:38.566Z","etag":null,"topics":["linux","linux-shell-implementation","linux-shell-in-c"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JohnniesHere.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-06-05T09:15:26.000Z","updated_at":"2024-07-28T12:30:03.000Z","dependencies_parsed_at":"2024-06-24T07:42:17.764Z","dependency_job_id":"850fb727-db59-4d1c-953e-eeedfd514557","html_url":"https://github.com/JohnniesHere/shell-program","commit_stats":null,"previous_names":["johnnieshere/shell-program"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/JohnniesHere/shell-program","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohnniesHere%2Fshell-program","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohnniesHere%2Fshell-program/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohnniesHere%2Fshell-program/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohnniesHere%2Fshell-program/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JohnniesHere","download_url":"https://codeload.github.com/JohnniesHere/shell-program/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JohnniesHere%2Fshell-program/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32402670,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-28T19:38:08.556Z","status":"ssl_error","status_checked_at":"2026-04-28T19:37:55.688Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["linux","linux-shell-implementation","linux-shell-in-c"],"created_at":"2024-10-15T17:47:21.704Z","updated_at":"2026-04-28T22:34:14.934Z","avatar_url":"https://github.com/JohnniesHere.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"Authorize: Jonathan Elgarisi\n\n## Shell Program \nThis is a simple shell program written in C for Linux-based machines. It reads commands from the user or a script file,\nexecutes them, and handles special commands like \\\"alias\\\", \\\"unalias\\\",\nand \\\"source\\\". It also counts the number of commands, script lines, and\ncommands that contains quotes. It uses a stack to check for quotes in\nthe input.\n\n## Features\n- Execute commands from user input or a script file. \n-Handle special commands: \\\"alias\\\", \\\"unalias\\\", and \\\"source\\\". \n- Count the number of commands, script lines, and commands that contain\nquotes. - Check for matching quotes in the input using a stack. \n- Support for \u0026\u0026 and \\|\\| operators. \n- Support for \u0026 operator. \n- Support for 2\\\u003e operator. \n- Support for jobs command.\n\n## How to Run\nTo compile the program, use the following command:\n```bash\n#!/bin/bash gcc -Wall ex1.c -o ex1\n```\nOr use the run_me.sh script file as an alternative to compiling it\nyourself.\n\n## How to Use\n After succesfully launching the script or the command\nlines provided above you can enter Linux commands or using one of the\nspecial commands.\n\n*Special Commands: \n-alias: creates a shortcut for a command in the\nformat alias \\\u003cname\\\u003e=\\'\\\u003ccommand\\\u003e\\' and will save it in a linked-list\nstrcture.\n         In order to see the aliases list enter the word alias. \n```bash \n        alias ll='ls -l' #will assaign ll as a shortcut for the command ls -l. then, typing alias will result with the output: ll='ls -l'\n```\n\n-unalias: to remove a shortcut from the aliases list \n```bash\n        unalias ll #will remove the shortcut ll from the aliases linked-list) \n```\n-source: running script files, in order to use this command enter this format source \u003cscript_file_name.including_extention\u003e\n```bash\n        source script.sh will run the script.sh file located at the same folder as this shell)\n```\n-exit_shell: closes the shell program and prints the number of commands\n        that contained quotes. \n\n-jobs: displays all processes running in the background. \n        Example:\n```bash\n        sleep 50 \u0026 \n        sleep 50 \u0026\n        sleep 50 \u0026\n        #Starts 3 background processes.\n```\n\n```bash\n        jobs #Shows all running background processes with their PIDs.\n        [1] sleep 50 \u0026 \n        [2] sleep 50 \u0026 \n        [3] sleep 50 \u0026\n```\n\n## Additional Features:\n - \u0026\u0026 and || operators: These operators allow conditional execution of commands.\n - \u0026\u0026: Command2 will run only if Command1 successfully executed.\n - ||: Command2 will run only if Command1 failed to execute.\nExample:\n```\n                asdf \u0026\u0026 ls #asdf is not a valid command, so ls will not be executed. \n                asdf || ls asdf is not a valid command, so ls will be executed.\n```\n\n\u0026 operator: The \u0026 character at the end of a command will run the command in the background, allowing the user to run more commands immediately. \nExample:\n```bash\n        sleep 5 #Runs sleep for 5 seconds, and the shell is \"stuck\" during this time.\n        sleep 5 \u0026 #Runs sleep for 5 seconds in the background, allowing immediate command input.\n```\n\n2\u003e operator: Redirects error output (stderr) to a file.\nExample:\n```bash\n         command 2\u003e error_log #Runs the command, writing any error messages to the file error_log. \n         aaaa 2\\\u003e E #aaaa is not a valid command, so its error message is written to E. cat E will print the error message from the file.\n         (aaa \u0026\u0026 ls) 2\\\u003e EE #If aaa is invalid, its error message is written to EE, and ls will not be executed.\n```\n## Output\nAccording to your commands.\nErrors will be provide information if occurs.\n\n## Files\n - ex1.c: The main file containing the shell program.\n - Stack.h: Contains the definition and functions for a stack data structure used for checking matching quotes.\n - Alias.h: Contains the definition and functions for handling command aliases.\n - Jobs.h: Contains the definition and functions for handling background jobs.\n - runData.h: Contains the definition for tracking script lines and quote counts.\n - run_me.sh: A script file to run the shell program.\n - README.txt: The text file you\\'re currently reading.\n\n## License\nMIT- https://choosealicense.com/licenses/mit/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnnieshere%2Fshell-program","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohnnieshere%2Fshell-program","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohnnieshere%2Fshell-program/lists"}