cozytk / minishell

0 stars 1 forks source link

execve 함수의 에러 메시지와 $? #29

Open cozytk opened 3 years ago

cozytk commented 3 years ago
taekkim@DESKTOP-0REN5FP:~/minishell$ ls asdkhaskjdhaskjdhask
ls: cannot access 'asdkhaskjdhaskjdhask': No such file or directory
taekkim@DESKTOP-0REN5FP:~/minishell$ ls -----a
ls: unrecognized option '-----a'
Try 'ls --help' for more information.
taekkim@DESKTOP-0REN5FP:~/minishell$ $?
2: command not found
taekkim@DESKTOP-0REN5FP:~/minishell$ cat asdkasldasldjsldjlasdjasldjas
cat: asdkasldasldjsldjlasdjasldjas: No such file or directory
taekkim@DESKTOP-0REN5FP:~/minishell$ cat ------------a
cat: unrecognized option '------------a'
Try 'cat --help' for more information.
taekkim@DESKTOP-0REN5FP:~/minishell$ $?
1: command not found

선생님 이건 못할 것 같습니다 ㅈㅈ 에러메시지도 다다르고 심지어 동일한 에러메시지에 $? 값도 다르네여

nonalias commented 3 years ago

홀리몰리...

nonalias commented 3 years ago

근데 이건 binary file에 따라서 결과값이 달라서 신경 쓰지 않아도 같은 환경이라면 결과값이 같지 않을까요?

nonalias commented 3 years ago

일단 제 맥북에서는 서로 같습니다.

bash-3.2$ ls dsfjiwofjewoifjwfojfwe
ls: dsfjiwofjewoifjwfojfwe: No such file or directory
bash-3.2$ ls ----------------a
ls: illegal option -- -
usage: ls [-@ABCFGHLOPRSTUWabcdefghiklmnopqrstuwx1%] [file ...]

image

nonalias commented 3 years ago

$? 는 다메다메..

cozytk commented 3 years ago

오잉,, 퍼킹 리눅스,,