subject - gachi-mandoo-shell/Docs GitHub Wiki
As beautiful as a shell
μμ½: μ΄λ² νλ‘μ νΈμ λͺ©νλ κ°λ¨ν μ Έμ λ§λλ κ²μ λλ€. λ§μμ. λΉμ λ§μ μμ bashλ zshμ΄μ. νλ‘μΈμ€λ νμΌ λμ€ν¬λ¦½ν°μ λν΄ μμ£Ό λ§μ΄ λ°°μ°κ² λ κ²λλ€.!
Program name | minishell |
---|---|
Turn in files | |
Makefile | Yes |
Arguments | |
External functs | printf, malloc, free, write, open, read, close, fork, wait, waitpid, wait3, wait4, signal, kill, exit, getcwd, chdir, stat, lstat, fstat, execve, dup, dup2, pipe, opendir, readdir, closedir, strerror, errno, isatty, ttyname, ttyslot, ioctl, getenv, tcsetattr, tcgetattr, tgetent, tgetflag, tgetnum, tgetstr, tgoto, tputs |
Lift authorized | Yes |
Description | Write a shell |
Your shell should:
- Not use more than one global variable, think about it and be ready to explain why you do it.
- λ μ΄μμ μ μ λ³μλ₯Ό μ¬μ©νμ§ λ§κ³ κ·Έκ²μ λν΄ μκ°νκ³ μ κ·Έλ κ²νλμ§ μ€λͺ ν μ€λΉλ₯Όνμμμ€.
- Show a prompt when waiting for a new command
- μλ‘μ΄ λͺ λ Ήμ΄λ₯Ό μ λ ₯ν μ μλ ν둬ννΈλ₯Ό 보μ¬μ€μΌ ν©λλ€.
- Search and launch the right executable (based on the PATH variable or by using relative or absolute path) like in bash
- bashμμμ²λΌ (PATH λ³μλ μλ, μ λ κ²½λ‘λ₯Ό νμ©ν΄) μ¬λ°λ₯Έ μ€ννμΌμ μ°Ύκ³ μ€νν μ μμ΄μΌ ν©λλ€.
- It must implement the builtins like in bash:
-
- echo with option β-nβ
- cd with only a relative or absolute path
- pwd without any options
- export without any options
- unset without any options
- env without any options and any arguments
- exit without any options 4 Minishell As beautiful as a shell
- ; in the command should separate commands like in bash
- β and " should work like in bash except for multiline commands
- Redirections < > β>>β should work like in bash except for file descriptor aggregation
- Pipes | should work like in bash except for multiline commands
- Environment variables ($ followed by characters) should work like in bash
- $? should work like in bash
- ctrl-C, ctrl-D and ctrl-\ should have the same result as in bash
- Use up and down arrows to navigate through the command using termcap (mandatory) history which we will then be able to edit (at least like we can for classic lines) if we feel like it (the line, not the history).
- If the Mandatory part is not perfect donβt even think about bonuses
- You donβt need to do all the bonuses
- Redirection β<<β like in bash
- Advance history and line editing with Termcaps (you must use only authorized functions)
- Edit the line where the cursor is located.
- Move the cursor left and right to be able to edit the line at a specific location. Obviously new characters have to be inserted between the existing ones similarly to a classic shell.
- Cut, copy, and/or paste all or part of a line using the key sequence you prefer.
- Move directly by word towards the left or the right using ctrl+LEFT and ctrl+RIGHT.
- Go directly to the beginning or the end of a line by pressing home and end.
- Write AND edit a command over a few lines. In that case, we would love that ctrl+UP and ctrl+DOWN allow to go from one line to another in the command while remaining in the same column or otherwise the most appropriate column.
- &&, || with parenthesis for priorities, like in bash
- wilcard * like in bash