{"id":22124198,"url":"https://github.com/federicoponzi/myshell","last_synced_at":"2026-05-17T01:48:24.415Z","repository":{"id":11447583,"uuid":"13906770","full_name":"FedericoPonzi/myshell","owner":"FedericoPonzi","description":"A terminal shell in C ","archived":false,"fork":false,"pushed_at":"2018-06-05T13:19:10.000Z","size":26,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-29T13:12:08.817Z","etag":null,"topics":["shell"],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/FedericoPonzi.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}},"created_at":"2013-10-27T17:25:42.000Z","updated_at":"2022-06-13T22:16:19.000Z","dependencies_parsed_at":"2022-08-30T01:32:13.767Z","dependency_job_id":null,"html_url":"https://github.com/FedericoPonzi/myshell","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FedericoPonzi%2Fmyshell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FedericoPonzi%2Fmyshell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FedericoPonzi%2Fmyshell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FedericoPonzi%2Fmyshell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FedericoPonzi","download_url":"https://codeload.github.com/FedericoPonzi/myshell/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245230934,"owners_count":20581585,"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":["shell"],"created_at":"2024-12-01T15:46:51.328Z","updated_at":"2026-05-17T01:48:19.363Z","avatar_url":"https://github.com/FedericoPonzi.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"Myshell\n========\nA shell created for fun and study.\n\n## Supported commands:\n\n * echo \u003ctext\u003e\n * clear\n * exit\n * clear\n * external command\n\n---\n\nThis shell is still a working progress! It can do basic things, but there is still a lot I wish to do!\n\n### Todo:\n * Use more complex parsing (EBNF in progress) to parse\n * Handle I/O redirects.\n\n## Soft todo:\n * Handle environemnt variables\n\n## Long todo:\n * tab completition for commands\n * Add basic scripting stuff: If/for/while\n\n## Very long todo:\n * Run script file. myshell batch.msh\n * Source command\n\n## LONG LONG todo:\n * - Load configuration files: `~/.myshrc`\n\n\n## Wanted:\n\n * personalized prompt: add username, hostname ecc.\n * STDIN STDOUT redirect: using `\u003c`` and `\u003e`, later maybe add `\u003e\u003e` for append, `\u003e` to overwrite and `\u0026\u003e` support ecc.\n * support for background processes: \u0026 to background, fg and bg commands. Don't exit if there are background processes.\n * history: history command, up and down keys, record commands in a history file. Maybe one day add ctrl+r/ctrl+s to find ecc.\n * Some nice-to-have commands: jobs, cd, history, exit, kill.\n * if-then-else: basic scripting support.\n\n\n----\n\nTrying to being a bit formal here. Mysh is based on this EBNF language:\n\n```\nprogram := statement+ [\u0026];\nstatement := command [connector]\nconnector := { || or \u0026\u0026 or | } statement | ; statement |\nredirection := \u003c filename or \u003e filename\ncommand := command_list var_args [redirection]\ncommand_list := \"echo\" | \"exit\" | \"clear\" | \"help\" | \"sleep\" ..... | anyCharacterNoSapces\nvar_arg := term | var_arg | e\nterm = anyCharacterNoSpaces+ | \"anyCharacterWithSpaces+\"\n```\n\ncat file.txt | cat | cat | cat\ncat file \u003e out.txt\ncat file \u003e out.txt \u0026\u0026 cat out.txt | out.txt\ncat 1.txt | cat \u003c 2.txt\n\nIn future (maybe):\n```\nprogram := statement+ [\u0026];\nstatement := command [connector]\nconnector := { || or \u0026\u0026 or | } statement | ; statement |\nredirection := \u003c filename | \u003e filename | \u003c filename \u003e filename\nassingment := id '=' expr\nvar_arg := lit | var_arg | e\nterm :=  [0-9]+ | \\\"[any char]\\\"\ncommand := \"echo\" | \"exit\" | \"clear\" | \"help\" | \"sleep\"\nvar_arg\n```\n\n1. leggo il comando\n\n\n\ncat file \u003e out.txt \u0026\u0026 cat out.txt | out.txt\n\n`cat file \u003e out.txt`\nlo aggiungo alla lista di comandi da eseguire\n\nLeggo connector. Mi salvo qual è. Il comando AND, wrappa un comando normale, che viene eseguito solo se il codice del precedente è 0\nLeggo cat out.txt. Lo salvo nella lista di comandi da eseguire\n\nLeggo Pipe. Mi salvo l'informazione, e wrappo out.txt. Il problema è che out.txt dovrebbe essere eseguito contemporaneamente con out.txt\nnella esecuzione, se il comando successivo è di tipo pipe, allora lo avvio ed eseguo la redirezione del stdout.\nPrima eseguo la pipe, poi attivo il redirect dell'output.\n\n\nPseudocode for parsing the command name:\nwhile isspace(line[i]) and line[i] != \\0; # trim\n    line[i] = \\0;\n    i++\nwhile line[i] != \" \" \u0026\u0026 line[i] != \"\\0\": # command name\n    i++;\nstrncpy(line, arg-\u003ecommand_name, i-last_index);\nbreak;\n\nPseudocode for parsing the arguments:\nwhile line[i] == \" \" and line[i] != \\0 and line[i] != connector:\n   line[i] = \\0;\n\n   if line[i] == '\\\"':\n    while line[i] != \"\\\\\\\"\":\n        i++;\n   else:\n       while isspace(line[i]) \u0026\u0026 line[i] |= \\0:\n         i++;\n   arg =malloc();\n   strncpy(line+i, arg, last -i);\n   command-\u003eargs.append(arg);\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffedericoponzi%2Fmyshell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffedericoponzi%2Fmyshell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffedericoponzi%2Fmyshell/lists"}