subject - gachi-mandoo-shell/Docs GitHub Wiki

Minishell

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
⚠️ **GitHub.com Fallback** ⚠️