Skip to content

subject

JaeSeoKim edited this page Apr 7, 2021 · 6 revisions

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
Clone this wiki locally