[minidive bash] Definition

pinelancer·2021년 10월 20일
0

minishell

목록 보기
1/6

minishell 기능 구현에 앞서 bash manual 중요한 부분 밑줄 그어가며 읽기1

2. Definition

  • POSIX
    A family of open system standards based on Unix. Bash is primarily concerned with the Shell and Utilities portion of the posix 1003.1 standard.

  • blank
    A space or tab character.

  • builtin
    A command that is implemented internally by the shell itself, rather than by an executable program somewhere in the file system.

  • control operator
    A token that performs a control function. It is a newline or one of the following: ‘||’, ‘&&’, ‘&’, ‘;’, ‘;;’, ‘;&’, ‘;;&’, ‘|’, ‘|&’, ‘(’, or ‘)’.

  • exit status
    The value returned by a command to its caller. The value is restricted to eight bits, so the maximum value is 255.

  • field
    A unit of text that is the result of one of the shell expansions. After expansion, when executing a command, the resulting fields are used as the command name and arguments.

  • filename
    A string of characters used to identify a file.

  • job
    A set of processes comprising a pipeline, and any processes descended from it, that are all in the same process group.

  • job control
    A mechanism by which users can selectively stop (suspend) and restart (resume) execution of processes.

  • metacharacter
    A character that, when unquoted, separates words. A metacharacter is a space, tab, newline, or one of the following characters: ‘|’, ‘&’, ‘;’, ‘(’, ‘)’, ‘<’, or ‘>’.

  • name
    A word consisting solely of letters, numbers, and underscores, and beginning with a letter or underscore. Names are used as shell variable and function names. Also referred to as an identifier.

  • operator
    A control operator or a redirection operator. See Section 3.6 [Redirections], page 35, for a list of redirection operators. Operators contain at least one unquoted metacharacter.

  • process group
    A collection of related processes each having the same process group id.

  • process group ID
    A unique identifier that represents a process group during its lifetime.

  • reserved word
    A word that has a special meaning to the shell. Most reserved words introduce shell flow control constructs, such as for and while.

  • return status
    A synonym for exit status. signal A mechanism by which a process may be notified by the kernel of an event occurring in the system.

  • special builtin
    A shell builtin command that has been classified as special by the posix standard.

  • token
    A sequence of characters considered a single unit by the shell. It is either a word or an operator.

  • word
    A sequence of characters treated as a unit by the shell. Words may not include unquoted metacharacters.

밑줄 모음

POSIX

posix 1003.1 standard.

builtin

A command that is implemented internally by the shell itself

control operator

newline or one of the following: ‘||’, ‘&&’, ‘&’, ‘;’, ‘;;’, ‘;&’, ‘;;&’, ‘|’, ‘|&’, ‘(’, or ‘)’

exit status

The value is restricted to eight bits, so the maximum value is 255

field

the resulting fields are used as the command name and arguments

job

A set of processes comprising a pipeline,that are all in the same process group

metacharacter

A character that, when unquoted, separates words : ‘|’, ‘&’, ‘;’, ‘(’, ‘)’, ‘<’, or ‘>’.

operator

A control operator or a redirection operator, Operators contain at least one unquoted metacharacter.

return status

A synonym for exit status

token

a word or an operator

word

Words may not include unquoted metacharacters.

정리

구조도 그리기



Created by ganadabang.

These images are licensed under a Creative Commons Attribution 4.0 International License.

구조도-프로토 타입



파싱 아이디어

파싱 흐름

  1. blank단위로 token을 차례대로 분리
  2. foreach if isoper(token) == true then oper else word
  3. operator -> control? redirection?
  4. word -> cmd? args?
  5. word -> double quoting이 있다면 double quote 단위로 expansion 후 join

에러 처리

  1. 대부분의 경우 operator의 전후로 word가 있어야 함 없는 경우 신택스 에러(예외: `;' ... 등?)

Reference

GNU Bash manual

profile
🏃🏾

0개의 댓글