mahahahad / Minishell

1 stars 1 forks source link

Add parsing functionality #24

Closed mahahahad closed 1 month ago

Ali-Danish-72 commented 2 months ago

VS Code detected an unused variable in the function parse_exec(). I tried to see if there is any use for the variable i, and it seems to be really out of place... as in it not being of any use. I am not sure how the compiler hasn't caught it.

mahahahad commented 2 months ago

Yes, that was there because of the previous approach I was using and became redundant when I changed it and forgot to remove it.

Ali-Danish-72 commented 2 months ago

About the multiple redirections, there is an error. The innermost redirection takes affect when it should be the outermost redirection, in terms of the structure you have.

case: echo hi > p > o > i > u > y

expected output of cat y:

hi

actual output:

expected output of cat p:

actual output:

hi

The same thing is also present with the input redirections. I believe the simple solution would be to simply dup the first file directly, instead of trying to find the deepest node and then duping it.