note the previous examples in bash, the current dir has a directory called include, and when I tried to execute the command include it gave me include/: is a directory and returned the status 126
and this the behavior in our shell69 in the same directory
[/Users/afatimi/git/1337/minishell-1337]
➤ include
shell69: include: command not found
[/Users/afatimi/git/1337/minishell-1337]
➤ echo $?
127
needed changed:
error should change from include: command not found to include/: is a directory
exit status should change from 127 to 126
executing a non-existent command : directory case
let's take an example with ls, its full path is /bin/ls, so when u try to execute some garbage command such as /bin/ls/wdswsws, it should fail with the error `/bin/ls/wdswsws not a directory`, shell69 does this just alright, but it fails to set the correct return status, we return 255 (-1), which we should return 126, here's how to replicate the issue
bash output:
$ /bin/ls/wdswsws
/bin/ls/wdswsws: Not a directory
(16:08:53) [ afatimi@e3r8p18 | ~/git/1337/minishell-1337 ] (main)
$ echo $?
126
our output
[/Users/afatimi/git/1337/minishell-1337]
➤ /bin/ls/wdswsws
shell69: /bin/ls/wdswsws: Not a directory
[/Users/afatimi/git/1337/minishell-1337]
➤ echo $?
255
executing a non-existent command : file case
when executing a command doesn't exists such as /de/fr/s/ws/cr/cr/ (randomness), bash exists with 127, we exist with 255 (-1)
hello, there is a case related to 3 errors when executing a command
executing a directory command in the current directory
the first one is when u execute a command that has the same name of a directory in the current directory
note the previous examples in bash, the current dir has a directory called
include
, and when I tried to execute the commandinclude
it gave meinclude/: is a directory
and returned the status 126and this the behavior in our shell69 in the same directory
needed changed:
include: command not found
toinclude/: is a directory
executing a non-existent command : directory case
let's take an example with ls, its full path is
/bin/ls
, so when u try to execute some garbage command such as/bin/ls/wdswsws
, it should fail with the error`/bin/ls/wdswsws
not a directory`, shell69 does this just alright, but it fails to set the correct return status, we return 255 (-1), which we should return 126, here's how to replicate the issuebash output:
our output
executing a non-existent command : file case
when executing a command doesn't exists such as
/de/fr/s/ws/cr/cr/
(randomness), bash exists with 127, we exist with 255 (-1)