{"id":13782870,"url":"https://github.com/FreeJules/simple_shell","last_synced_at":"2025-05-11T16:33:13.776Z","repository":{"id":86404009,"uuid":"87597217","full_name":"FreeJules/simple_shell","owner":"FreeJules","description":"UNIX command line interpreter","archived":false,"fork":false,"pushed_at":"2017-10-15T20:21:24.000Z","size":133,"stargazers_count":1,"open_issues_count":1,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-08-03T18:16:55.994Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/FreeJules.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,"governance":null,"roadmap":null,"authors":"AUTHORS"}},"created_at":"2017-04-08T00:40:26.000Z","updated_at":"2017-07-06T22:44:32.000Z","dependencies_parsed_at":null,"dependency_job_id":"5cabd062-57b4-4d67-9985-60e8d62f2726","html_url":"https://github.com/FreeJules/simple_shell","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/FreeJules%2Fsimple_shell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FreeJules%2Fsimple_shell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FreeJules%2Fsimple_shell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/FreeJules%2Fsimple_shell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/FreeJules","download_url":"https://codeload.github.com/FreeJules/simple_shell/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253595984,"owners_count":21933488,"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-03T18:01:46.747Z","updated_at":"2025-05-11T16:33:13.542Z","avatar_url":"https://github.com/FreeJules.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"# Scarjo\nScarjo is a simple shell created as an end of term project for @holbertonschool.\n\n## Table of Contents\n* [**Project Details**](#project-details)\n\t* [Description](#description)\n\t\t* [Function Visualization](#function-visualization)\n\t\t* [File descriptions](#file-descriptions)\n\t* [Project Requirements](#project-requirements)\n\t* [Project Objectives](#what-students-should-learn-from-this-project)\n* [**Project Breakdown**](#project-breakdown)\n* [**Getting Started**](#getting-started)\n    * [Installation](#installation)\n\t* [Screenshots](#screenshots)\n* [**Contributing**](#contributing)\n* [**Team**](#team)\n* [**Resources**](#resources)\n\n---\n## Project Details\n\n### Description\nScarJo Shell (hsh) is a simple UNIX command line shell and was built as an end of term project for [Holberton School](https://github.com/holbertonschool/). ScarJo includes many basic features present in the bash shell.\n\n#### Function visualization\n![image](https://cloud.githubusercontent.com/assets/23224088/25165641/5b9504f8-248c-11e7-8d0d-c874620cea9a.png)\nTo interact with image, [click here](https://sketchboard.me/XArlTLxbFDKu).\n\n#### File descriptions\n\nFile Functions contained | Description and Return value \n------ | :---\n**[\\_getline.c](/_getline.c)**\u003cul\u003e\u003cli\u003eint _getline(char *input, int size)\u003c/li\u003e\u003cli\u003eint exit_shell(char *line)\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003eDescription\u003c/li\u003e\t\u003cul\u003e\u003cli\u003e\\_getline() uses _strprint to  reads an entire line from standard input, storing the address of the buffer containing the text into *lineptr.  The buffer is null-terminated and includes the newline character, if one was found.\u003c/li\u003e\u003c/ul\u003e\u003cli\u003eReturn value\u003c/li\u003e\t\u003cul\u003e\u003cli\u003eIf *input is NULL, then \\_getline() will allocate a buffer for storing the line, which should be freed by the user program.  (In this case, the value in \\*n is ignored.)\u003c/li\u003e\t\u003cli\u003eOn  success,  \\_getline() return the number of characters read, including the delimiter character, but  not including  the terminating null byte ('\\0').  This value can be used to handle embedded null bytes in the line read.\u003c/li\u003e\t\u003cli\u003eBoth functions return -1 on failure to read a line  (including end-of-file condition).  In the event of an error, errno is set to indicate the cause.\u003c/li\u003e\u003c/ul\u003e\u003c/ul\u003e\n**[\\_strtok.c](/_strtok.c)**\u003cul\u003e\u003cli\u003eint count_words(char *str, char delim)\u003c/li\u003e\u003cli\u003eint _wrdlen(char *s, char delim)\u003c/li\u003e\u003cli\u003echar **strtow(char *str, char delim)\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003eDescription\u003c/li\u003e\u003cul\u003e\u003cli\u003eThis program is our implementation of the strtok() function which extracts tokens from strings.\u003c/li\u003e\t\u003cli\u003eThe  \\_strtok()  function breaks a string into a sequence of zero or more nonempty tokens.  On the first call to \\_strtok() the string to be parsed should be specified in `str`.  In each subsequent call that should parse the same string, `str` must be NULL.\u003c/li\u003e\u003cli\u003e       The delim argument specifies a set of bytes that delimit the tokens in the parsed string.  The caller may specify different strings in delim in successive calls that parse the same string.\u003c/li\u003e\u003cli\u003e       Each call to \\_strtok() returns a pointer to a null-terminated string containing the next token.  This string does not include the delimiting byte. If no  more tokens are found, \\_strtok() returns `NULL`.\u003c/li\u003e\u003c/ul\u003e\u003cli\u003eReturn value\u003c/li\u003e\u003cul\u003e\t\u003cli\u003eReturns string tokenized into words\u003c/li\u003e  \u003cli\u003eThe `_strtok()` functions return a pointer to the next token, or `NULL` if there are no more tokens.\u003c/li\u003e\u003c/ul\u003e\u003c/ul\u003e\n**[array_list.c](/array_list.c)**\u003cul\u003e\u003cli\u003e`int arr_size(char **arr)`\u003c/li\u003e\u003cli\u003e`list_t *array_to_list(char **array)`\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003e\u003cli\u003eDescription\u003c/li\u003e\u003c/li\u003e  \u003cul\u003e\t\u003cli\u003eThis program builds a linked list of an array of pointers.\u003c/li\u003e\u003c/ul\u003e\u003cli\u003eReturn value\u003c/li\u003e\u003cul\u003e\u003cli\u003eA pointer of type `list_t` to head\u003c/li\u003e\u003c/ul\u003e\u003c/ul\u003e\n**[lists.c](/lists.c)**\u003cul\u003e\u003cli\u003e`size_t print_list(const list_t *h)`\u003c/li\u003e\u003cli\u003e`size_t list_len(const list_t *h)`\u003c/li\u003e\u003cli\u003e`list_t *add_node(list_t \\*\\*head, const char *str)`\u003c/li\u003e\u003cli\u003e`list_t *add_node_end(list_t \\*\\*head, const char *str)`\u003c/li\u003e\u003cli\u003e`void free_list(list_t *head)`\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003eDescription\u003c/li\u003e\u003cul\u003e\u003cli\u003e`print_list(const list_t *h)` prints all elements of a linked list pointed to by **\\*h**\u003c/li\u003e\u003cli\u003e`size_t list_len(const list_t *h)` calculates the number of elements in a linked list pointed to by **\\*h**\u003c/li\u003e\u003cli\u003e`list_t *add_node(list_t **head, const char *str)` adds node to the beginning of a linked list\u003c/li\u003e\u003cli\u003e`list_t *add_node_end(list_t **head, const char *str)` adds node to the end of a linked list\u003c/li\u003e\u003cli\u003e`void free_list(list_t *head)` frees a linked list of type\u003c/li\u003e\u003c/ul\u003e\u003cli\u003eReturn value\u003c/li\u003e\u003cul\u003e\u003cli\u003e`print_list()` prints elements of list to stdout\u003c/li\u003e\u003cli\u003e`size_t list_len()` length of list\u003c/li\u003e\u003cli\u003e`list_t *add_node()` address of the new element, NULL if failed\u003c/li\u003e\u003cli\u003e`list_t *add_node_end()` address of the new element, NULL if failed\u003c/li\u003e\u003cli\u003e`void free_list()` n/a\u003c/li\u003e\u003c/ul\u003e\u003c/ul\u003e\n**[main.c](/main.c)** | - | - |\n**[more_strings.c](/more_strings.c)** \u003cul\u003e\u003cli\u003e _strcmp(char *s1, char *s2)\u003c/li\u003e\u003cli\u003echar *_strchr(const char *str, char c)\u003c/li\u003e\u003cli\u003eint len_to_char(char *str, char c)\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003eDescription\u003c/li\u003e\u003cul\u003e\u003cli\u003e`int _strcmp(char *s1, char *s2)` - compare strings **s1** and **s2**\u003c/li\u003e\u003cli\u003echar *_strchr(const char *str, char c) - locate character in a string\u003c/li\u003e\u003cli\u003e`int len_to_cha r(char *str, char c)` - calculate length of string **str** up to char **c**\u003c/li\u003e\u003c\\ul\u003e\u003cli\u003eReturn value\u003c/li\u003e\u003cul\u003e\u003cli\u003e`int _strcmp(char *s1, char *s2)` - return an integer less than, equal to, or greater than zero if **s1** is found to be less than, to match, or to be greater than **s2**\u003c/li\u003e\u003cli\u003echar *_strchr(const char *str, char c) - a pointer to the matched character or NULL if the character is not found. \u003c/li\u003e\u003cli\u003eint len_to_char(char *str, char c) - length of string before char, 0 if char not found\u003c/li\u003e\u003c/ul\u003e |\n**[prints.c](/prints.c)** \u003cul\u003e\u003cli\u003eint _putchar(char c)\u003c/li\u003e\u003cli\u003evoid _strprint(char *str)\u003c/li\u003e\u003cli\u003evoid print_array(char \\**array)\u003c/li\u003e\u003c/ul\u003e| \u003cul\u003e\u003cli\u003eDescription\u003c/li\u003e\u003cul\u003e\u003cli\u003e`_putchar` - writes the character **c** to stdout\u003c/li\u003e\u003cli\u003e_strprint - prints a string\u003c/li\u003e\u003cli\u003eprint_array - Prints an array of strings\u003c/li\u003e\u003c/ul\u003e\u003cli\u003eReturn value\u003c/li\u003e\u003cul\u003e\u003cli\u003eReturn: On success 1. On error, -1 is returned, and errno is set appropriately.\u003c/li\u003e\u003c/ul\u003e\u003c/ul\u003e |\n**[shell.h](/shell.h)** | \u003cul\u003e\u003cli\u003eDescription\u003c/li\u003e  \u003cul\u003e\u003cli\u003eheader file for **ScarJo shell**\u003c/li\u003e\u003c/ul\u003e\u003cli\u003eReturn value\u003c/li\u003e\u003cul\u003e\u003cli\u003en/a\u003c/li\u003e\u003c/ul\u003e\u003c/ul\u003e |\n**[strings.c](/strings.c)** \u003cul\u003e\u003cli\u003eint _strlen(char *s)\u003c/li\u003e  \u003cli\u003eint _strncmp(char *s1, char *s2, int n)\u003c/li\u003e  \u003cli\u003echar *_strcpy(char *dest, char *src)\u003c/li\u003e  \u003cli\u003echar *_strcat(char *dest, char *src)\u003c/li\u003e  \u003cli\u003echar *_strdup(char *str)\u003c/li\u003e\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003eDescription\u003c/li\u003e\u003cul\u003e\u003cli\u003e`_strlen(const char *s)` returns the length of a string\u003c/li\u003e\u003cli\u003eint _strncmp(char *s1, const char *s2, int n) - compares two strings for n amount of chars\u003c/li\u003e\u003cli\u003echar *_strcpy(char *dest, const char *src) - copies the string with \\0 to the buffer\u003c/li\u003e\u003cli\u003echar *_strcat(char *dest, const char *src) - appends the src string to the dest string\u003c/li\u003e\u003cli\u003echar *_strdup(char *str) - returns a pointer to a newly allocated space in memory, which contains a copy of the string given as a parameter \u003c/li\u003e\u003c/ul\u003e\u003cli\u003eReturn value\u003c/li\u003e\u003cul\u003e\u003cli\u003e_strlen(const char *s) - Return: 0 on success\u003c/li\u003e\u003cli\u003eint _strncmp(char *s1, const char *s2, int n) - Return: 0 if identical\u003c/li\u003e\u003cli\u003echar *_strcpy(char *dest, const char *src) - Return: the pointer to dest\u003c/li\u003e\u003cli\u003echar *_strcat(char *dest, const char *src) - pointer to resulting string dest\u003c/li\u003e\u003cli\u003echar *_strdup(char *str) - pointer to new string or NULL if str = NULL\u003c/li\u003e\u003c/ul\u003e\u003c/ul\u003e\n**[built_ins.c](/built_ins.c)** \u003cul\u003e\u003cli\u003eint built_ins(char **input, list_t **env_head)\u003c/li\u003e\u003cli\u003eint exit_bi(char **line)\u003c/li\u003e\u003cli\u003eint print_env(char **line, list_t **env_head)\u003c/li\u003e\u003cli\u003eint set_env(char **line, list_t **env_head)\u003c/li\u003e\u003cli\u003eint unset_env(char **line, list_t **env_head)\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003eDescription\u003c/li\u003e  \u003cul\u003e    \u003cli\u003e`built_ins` - checks if command is a built-in @input: tokenized line from the command line @env_head: pointer to environ list\u003c/li\u003e\u003cli\u003eexit_bi - exits shell with given status @line: tokenized line from command line @env_head: pointer to environ list\u003c/li\u003e\u003cli\u003eprint_env - prints current environ @line: tokenized line from command line @env_head: pointer to environ list\u003c/li\u003e\u003cli\u003eset_env - initializes a new environment variable, or modify an existing one @line: tokenized line from command line @env_head: pointer to environ list\u003c/li\u003e\u003cli\u003eunset_env - removes environment variable @line: tokenized line from command line @env_head: pointer to environ list\u003c/li\u003e\u003c/ul\u003e\u003cli\u003eReturn value\u003c/li\u003e\u003cul\u003e  \u003cli\u003e`built_ins` - 0 on success, 1 on error, -1 if not found\u003c/li\u003e\u003cli\u003eexit_bi - 0 on success, 1 on error\u003c/li\u003e\u003cli\u003eprint_env - 0 on success, 1 on error\u003c/li\u003e\u003cli\u003eset_env - 0 on success, 1 on error\u003c/li\u003e\u003cli\u003eunset_env - 0 on success, 1 on error\u003c/li\u003e\u003c/ul\u003e\u003c/ul\u003e |\n**[cmd_line_loop.c](/cmd_line_loop.c)** `int cmd_line_loop(char *buffer, char *line, list_t **env_head)` | \u003cul\u003e  \u003cli\u003eDescription\u003c/li\u003e\u003cul\u003e\u003cli\u003ecmd_line_loop - calls getline until user enters exit or EOF(ctrl^D) @buffer: pointer to buffer to store input @line: pointer to a string of line input @env_head: pointer to head of environ list\u003c/li\u003e\u003c/ul\u003e\u003cli\u003eReturn value\u003c/li\u003e\u003cul\u003e\u003cli\u003eReturn: 0 on success or 1 if _realloc failed\u003c/li\u003e\u003c/ul\u003e\u003c/ul\u003e |\n**[new_env.c](/new_env.c)** \u003cul\u003e\u003cli\u003e`char *_getenv(char *name, list_t **env_head)`\u003c/li\u003e\u003cli\u003e`int _setenv(char *name, char *value, list_t **env_head)`\u003c/li\u003e\u003cli\u003e`int _unsetenv(char *name, list_t **env_head)`\u003c/li\u003e\u003cli\u003e`int delete_node(list_t **head, char *string)`\u003c/li\u003e\u003cli\u003e`char *var_str(char *name, char *value)`\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e  \u003cli\u003eDescription\u003c/li\u003e\u003cul\u003e\u003cli\u003e_getenv - gets an environment variable. (without using getenv) @name: environment variable name @env_head: pointer to environ list\u003c/li\u003e\u003cli\u003e_setenv - changes or adds the variable to the environment with the value, if variable does not already exist. If it does exist in the environment, then its value is changed to value @name: name of the variable @value: value of the variable @env_head: pointer to environ list\u003c/li\u003e\u003cli\u003e_unsetenv - deletes the variable name from the environment. If name does not exist in the environment, then the function succeeds, and the environment is unchanged. @name:name of the environment variable @env_head: pointer to environ list\u003c/li\u003e\u003cli\u003edelete_node - deletes the node with string of a list_t @head: pointer to head pointer @string: pointer to the node that should be deleted\u003c/li\u003e\u003cli\u003evar_str - creates new variable string @name: name of the variable @value: value of the variable\u003c/li\u003e\u003c/ul\u003e\u003cli\u003eReturn value\u003c/li\u003e\u003cul\u003e\u003cli\u003e_getenv - pointer to a string with that env variable or NULL if not found\u003c/li\u003e\u003cli\u003e_setenv - pointer to head of the list or NULL if it failed\u003c/li\u003e\u003cli\u003e_unsetenv - Always 0 on success, or 1 on error\u003c/li\u003e\u003cli\u003edelete_node - 0 if it succeeded, 1 if it failed\u003c/li\u003e\u003cli\u003evar_str - pointer to new string or NULL if failed\u003c/li\u003e\u003c/ul\u003e\u003c/ul\u003e |\n**[run_command.c](/run_command.c)** \u003cul\u003e\u003cli\u003e`char **path_dirs_array(list_t **env_head)`\u003c/li\u003e\u003cli\u003e`char *cmd_in_path(char *str, list_t **env_head)`\u003c/li\u003e\u003cli\u003e`int run_command(char **line_tok, list_t **env_head, char *buffer)`\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003eDescription\u003cul\u003e\u003cli\u003e`path_dirs_array` - makes array of pointers for all dirs in the PATH\u003c/li\u003e\u003cli\u003e`cmd_in_path` - finds command in the PATH @str: pointer to first string in input line (command) @env_head: pointer to environ list\u003c/li\u003e\u003cli\u003e`run_command` - runs the command typed into shell prompt @line_tok: tokenized input line @env_head: pointer to environ list\u003c/li\u003e\u003c/ul\u003eReturn value\u003cul\u003e\u003cli\u003e`path_dirs_array` - Return: Array of pointers\u003c/li\u003e\u003cli\u003e`cmd_in_path` - Return: pointer to absolute path of command or NULL if not found\u003c/li\u003e\u003cli\u003e`run_command` - Return: Always 0 on success, 1 on error\u003c/li\u003e\u003c/ul\u003e\u003c/ul\u003e |\n**[environment.c](/environment.c)**\u003cul\u003e\u003cli\u003e`char \\*_getenv(const char *name)`\u003c/li\u003e\u003cli\u003eint _putenv(char *str)\u003c/li\u003e\u003cli\u003eint _setenv(const char *name, const char *value, int overwrite)\u003c/li\u003e\u003cli\u003eint _unsetenv(const char *name)\u003c/li\u003e\u003cli\u003e`int delete_node(list_t \\*\\*head, char *string)`\u003c/li\u003e\u003c/ul\u003e | \u003cul\u003e\u003cli\u003eDescription\u003c/li\u003e\t\u003cul\u003e\u003cli\u003eContains helper functions that interact with environment variables.\u003c/li\u003e\t\u003cli\u003e  `*_getenv(const char *name)` searches environment list to find environment variable **name** and returns a pointer to the corresponding **value** string.\u003c/li\u003e\t\u003cli\u003e  `int _putenv(char *str)` changes or adds value of an environment variable\u003c/li\u003e\t\u003cli\u003e  `int _setenv(const char *name, const char *value, int overwrite)` change or add an environment variable\u003c/li\u003e\t\u003cli\u003e  `int _unsetenv(const char *name)` deletes the environment variable name from the environment\u003c/li\u003e\t\u003cli\u003e  `int delete_node(list_t \\**head, char *string)` deletes the node with string of of a list_t\u003c/li\u003e\u003c/ul\u003e\u003cli\u003eReturn value\u003c/li\u003e\u003cul\u003e\u003cli\u003e`*\\_getenv(const char *name)` returns a pointer to the value in the environment, or NULL if there is no match\u003c/li\u003e\t\u003cli\u003e`\\_putenv()` returns zero on success, or nonzero  if an  error  occurs. In the event of an error, errno is set to indicate the cause.\u003c/li\u003e\t\u003cli\u003e`\\_setenv()` returns zero on success, or -1 on error, with **errno** set to indicate the cause of the error\u003c/li\u003e\t\u003cli\u003e`\\_unsetenv()` returns zero on success, or -1 on error, with **errno** set to indicate the cause of the error\u003c/li\u003e\t\u003cli\u003e`delete_node()` returns 0 on success, or -1 on error\u003c/li\u003e\u003c/ul\u003e\u003c/ul\u003e\n\n### Project Requirements\n- Allowed editors: `vi`, `vim`, `emacs`\n- All your files will be compiled on Ubuntu 14.04 LTS\n- Your programs and functions will be compiled with `gcc 4.8.4` (`C90`) using the flags `-Wall -Werror -Wextra and -pedantic`\n\n[![image](https://cloud.githubusercontent.com/assets/23224088/24430835/7d83286c-13cd-11e7-9083-aadb330906b8.png)](https://twitter.com/egsy/status/833533513936703489)\n- All your files should end with a new line\n- A `README.md` file, at the root of the folder of the project is mandatory\n- Your code should use the `Betty` style. It will be checked using [`betty-style.pl`](https://github.com/holbertonschool/Betty/blob/master/betty-style.pl) and [`betty-doc.pl`](https://github.com/holbertonschool/Betty/blob/master/betty-doc.pl)\n- No more than 5 functions per file\n- All your header files should be include guarded\n- Unless specified otherwise, your program must have the exact same output as `sh` as long as the exact same error output.\n\n### What students should learn from this project\n\n## Project Breakdown\nTask # | Type | Short description\n ---: | --- | --- | \n0 | **Mandatory** | Write a README [link](/README.md)\u003cbr\u003eWrite a man for your shell.[link](/man_1_simple_shell)\u003cbr\u003eYou should have an AUTHORS file at the root of your repository, listing all individuals having contributed content to the repository. Format, see Docker [link](/AUTHORS)\n1 | **Mandatory** | Write a beautiful code that passes the Betty checks\n2 | **Mandatory** | Write a UNIX command line interpreter.\u003cbr\u003e\u003cbr\u003eYour Shell should:\u003cbr\u003e\u003cul\u003e\u003cli\u003eDisplay a prompt and wait for the user to type a command. A command line always ends with a new line.\u003c/li\u003e\u003cli\u003eThe prompt is displayed again each time a command has been executed.\u003c/li\u003e\u003cli\u003eThe command lines are simple, no semi-columns, no pipes, no redirections or any other advanced features.\u003c/li\u003e\u003cli\u003eThe command lines are made only of one word. No arguments will be passed to programs.\u003c/li\u003e\u003cli\u003eIf an executable cannot be found, print an error message and display the prompt again.\u003c/li\u003e\u003cli\u003eHandle errors.\u003c/li\u003e\u003cli\u003eYou have to handle the \"end of file\" condition (Ctrl+D). Exit with code 0\u003c/li\u003e\u003c/ul\u003eYou don't have to:\u003cbr\u003e\u003cul\u003e\u003cli\u003euse the PATH\u003c/li\u003e\u003cli\u003eimplement built-ins\u003c/li\u003e\u003cli\u003ehandle special characters : \", ', `, \\, *, \u0026, #\u003c/li\u003e\u003cli\u003ebe able to move the cursor\u003c/li\u003e\u003cli\u003ehandle commands with arguments\u003c/li\u003e\u003c/ul\u003e\n3 | ***Advanced***| Simple shell 0.1 +\u003cbr\u003e\u003cli\u003eWrite your own getline function\u003c/li\u003e\u003cli\u003eUse a buffer to read many chars at once and call the least possible the readsystem call\u003c/li\u003e\u003cli\u003eYou will need to use static variables\u003c/li\u003e\u003cli\u003eYou are not allowed to use getline\u003c/li\u003eYou don't have to:\u003cbr\u003e\u003cli\u003ebe able to move the cursor\u003c/li\u003e \n4 | **Mandatory** | Simple shell 0.1 +\u003cbr\u003e\u003cli\u003eHandle command lines with arguments\u003c/li\u003e\n5 | ***Advanced***| Simple shell 0.2 +\u003cbr\u003e\u003cli\u003eYou are not allowed to use strtok\u003c/li\u003e\n6 | **Mandatory** | Simple shell 0.2 +\u003cbr\u003e\u003cli\u003eHandle the PATH\u003c/li\u003e\n7 | **Mandatory** | Simple shell 0.3 +\u003cbr\u003e\u003cli\u003eImplement the exit buit-in, that exits the shell\u003c/li\u003e\u003cli\u003eUsage: exit\u003c/li\u003e\u003cli\u003eYou don't have to handle any argument to the built-in exit\u003c/li\u003e\n8 | ***Advanced***| Simple shell 0.4 +\u003cbr\u003e\u003cli\u003ehandle arguments for the built-in exit\u003c/li\u003e\u003cli\u003eUsage: exit status, where status is an integer used to exit the shell\u003c/li\u003e\n9 | ***Advanced***| Simple shell 0.4 +\u003cbr\u003e\u003cli\u003eHandle Ctrl+C: your shell should not quit when the user inputs ^C\u003c/li\u003eman 2 signal.\n10 | **Mandatory**  | Simple shell 4.0 +\u003cbr\u003e\u003cli\u003eImplement the env built-in, that prints the current environment\u003c/li\u003e\n11 | ***Advanced*** | Implement the setenv and unsetenv builtin commands\u003cbr\u003e**setenv**\u003cbr\u003e\u003cli\u003eInitialize a new environment variable, or modify an existing one\u003c/li\u003e\u003cli\u003eCommand syntax: setenv VARIABLE VALUE\u003c/li\u003e**unsetenv**\u003cbr\u003e\u003cli\u003eRemove a environment variable\u003c/li\u003e\u003cli\u003eCommand syntax: unsetenv VARIABLE\u003c/li\u003e\n12 | ***Advanced*** | Simple shell 1.0 +\u003cbr\u003e\u003cbr\u003eImplement the builtin command cd:\u003cbr\u003e\u003cli\u003eChanges the current directory of the process.\u003c/li\u003e\u003cli\u003eCommand syntax: cd [DIRECTORY]\u003c/li\u003e\u003cli\u003eIf no argument is given to cd the command must be interpreted like cd $HOME\u003c/li\u003e\u003cli\u003eYou have to handle the command cd -\u003c/li\u003e\u003cli\u003eYou have to update the environment variable PWD when you change directory\u003c/li\u003eman chdir, man getcwd\n13 | ***Advanced*** | Simple shell 1.0 +\u003cbr\u003eHandle the commands separator ;\n14 | ***Advanced*** | Simple shell 1.0 +\u003cbr\u003eHandle the \u0026\u0026 and || shell logical operators.\n15 | ***Advanced*** | Simple shell 1.0 +\u003cbr\u003e\u003cli\u003eHandle aliases\u003c/li\u003e\n16 | ***Advanced*** | Simple shell 1.0 +\u003cbr\u003e\u003cli\u003eHandle variables replacement\u003c/li\u003e\u003cli\u003eHandle the $? variable\u003c/li\u003e\u003cli\u003eHandle the $$ variable\u003c/li\u003e\n17 | ***Advanced*** | Simple shell 1.0 +\u003cbr\u003e\u003cli\u003eHandle comments (#)\u003c/li\u003e\n18 | ***Advanced*** | Simple shell 1.0 +\u003cbr\u003e\u003cli\u003eImplement the help buit-in\u003c/li\u003e\u003cli\u003eUsage: help [BUILTIN]\u003c/li\u003e\n19 | ***Advanced*** | Simple shell 1.0 +\u003cbr\u003e\u003cli\u003eImplement the history built-in, without any argument\u003c/li\u003e\u003cli\u003eThe history built-in displays the history list, one command by line, preceded with line numbers (starting at 0)\u003c/li\u003e\u003cli\u003eOn exit, write the entire history, without line numbers, to a file named .simple_shell_history in the directory $HOME\u003c/li\u003e\u003cli\u003eWhen the shell starts, read the file .simple_shell_history in the directory $HOME if it exists, and set the first line number to the total number of lines in the file modulo 4096\u003c/li\u003e\n20 | ***Advanced*** | Simple shell 0.1 +\u003cbr\u003e\u003cli\u003eUsage: simple_shell [filename]\u003c/li\u003e\u003cli\u003eYour shell can take a file as a command line argument\u003c/li\u003e\u003cli\u003eThe file contains all the commands that your shell should run before exiting\u003c/li\u003e\u003cli\u003eThe file should contain one command per line\u003c/li\u003e\u003cli\u003eIn this mode, the shell should not print a prompt and should not read from stdin\u003c/li\u003e\n21 | **Mandatory**  | Write a blog post describing step by step what happens when you type ls -l and hit Enter in a shell. Try to explain every step you know of, going in as much details as you can, give examples and draw diagrams when needed. You should merge your previous knowledge of the shell with the specifics of how it works under the hoods (including syscalls).\n22 | ***Advanced*** | Build a test suite for your shell.\u003cbr\u003e\u003cli\u003eThe test suite should cover every tasks from 0. to 20.\u003c/li\u003e\u003cli\u003eThe test suite should cover every regular cases (many different examples) and edge cases possible\u003c/li\u003e\u003cli\u003eThe entire class will work on the same test suite. Use only one repository (don't forget the README.md file)\u003c/li\u003e\u003cli\u003eStart adding tests asap and not just before the deadline in order to help everyone from day 0\u003c/li\u003e\u003cli\u003eYou can take (or fork) inspiration from this example, but it is not to follow this format/way\u003c/li\u003e\u003cli\u003eAdopt a style and be consisten. You can for instance follow this style guide. If you chose a style that already exist, add it to the README in a style section. If you write your own, create a wiki page attached to the project and refer to it in the README style section.\u003c/li\u003e\u003cli\u003eIf you choose to use this code, make sure to update the style accordingly\u003c/li\u003e\u003cli\u003eYou should have an AUTHORS file, listing all individuals having contributed content to the repository. Format, see Docker\u003c/li\u003e\u003cbr\u003eThis is a task shared by everyone in the class. Everyone will get the same score for this task. Go team!\n\n## Getting Started\nUsing ScarJo shell is as easy as 1-2-3! Simply clone this repository onto your local machine, compile with the flags listed below and run!\n\n### Installation\n1. Clone\n```sh\ngit clone https://github.com/FreeJules/simple_shell.git\n```\n2. On your machine, navigate (`cd`) to the newly created directory then compile with the following tags.\n\n```sh\ncd simple_shell\ngcc -Wall -Werror -Wextra -pedantic *.c -o hsh\n```\n3. Run shell\n```sh\n./hsh\n```\n4. Run commands and enjoy!\n5. To exit\n```sh\nexit\n```\n\n![hsh-compilation1](https://cloud.githubusercontent.com/assets/23224088/25164687/638bb300-2487-11e7-9484-8a4a24fde768.gif)\n\n### Screenshots\nOnce in ScarJo shell you can interact with it in a number of ways.\n\n![hsh-usage](https://cloud.githubusercontent.com/assets/23224088/25169794/33528cca-249d-11e7-8c0a-a95fca7f10b8.gif)\n\n## Contributing\nThis project is a closed and contributions are not accepted at this time. \n\n## Team\n\n[![Julija Lee](https://avatars0.githubusercontent.com/u/6486822?v=3\u0026s=230)](https://github.com/FreeJules/) | [![Elaine Yeung](https://avatars3.githubusercontent.com/u/23224088?v=3\u0026s=230)](https://github.com/yeungegs)\n:---:|:---:\n[Julija Lee](https://github.com/FreeJules) \u003ca target=\"_blank\" href=\"https://twitter.com/leejulija\"\u003e \u003cimg src=\"https://cloud.githubusercontent.com/assets/23224088/24941419/2f3fc5ce-1eff-11e7-9ed3-85693579df09.png\" height=\"20\"\u003e\u003c/a\u003e | [Elaine Yeung](https://github.com/yeungegs) \u003ca target=\"_blank\" href=\"https://twitter.com/egsy\"\u003e \u003cimg src=\"https://cloud.githubusercontent.com/assets/23224088/24941419/2f3fc5ce-1eff-11e7-9ed3-85693579df09.png\" height=\"20\"\u003e\u003c/a\u003e\n\n## Resources\n* Readme template from GitHub https://guides.github.com/features/wikis/\n* Docker generate-authors script https://github.com/docker/docker/blob/master/hack/generate-authors.sh\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFreeJules%2Fsimple_shell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FFreeJules%2Fsimple_shell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FFreeJules%2Fsimple_shell/lists"}