[C][#JV1] Redirect stdout

Hi, everyone! Link to my git: GitHub - Treeesk/codecrafters-shell-c
I have an error that I cannot solve, I attach below the tests on which my program stop

remote: [your-program] ^[[0m$ "exe with \'single quotes\'" /tmp/foo/f3
remote: [your-program] exe with 'single quotes': command not found
remote: [tester::#QJ0] Output does not match expected value.
remote: [tester::#QJ0] Expected: "mango orange."
remote: [tester::#QJ0] Received: "exe with 'single quotes': command not found"
remote: [your-program] $
remote: [tester::#QJ0] Assertion failed.

I’ll take a look shortly.

I changed the code, now I have a slightly different error. I think the parse_input function needs to be fixed.

remote: [your-program] $ echo "world\"insidequotes"example\"
remote: [your-program] world"insidequotes example"
remote: [tester::#GU3] Output does not match expected value.
remote: [tester::#GU3] Expected: "world"insidequotesexample""
remote: [tester::#GU3] Received: "world"insidequotes example""

Hi @Treeesk, the bug is that argv[1] is getting truncated too early:

Did I understand correctly that the "that was encountered earlier with " was treated as a closing, and therefore the quotation mark before the Script was treated as a new one? " which comes after \ should be counted as the ending " or should it just be escaped and skipped?
I would also appreciate running a separate test as soon as possible to debug the code more accurately. I can’t run the program because I don’t have one of the libraries.

Sorry, my previous response was incomplete.

The issue is that neighboring “parts” were not concatenated:

There should be no spaces between the highlighted parts.

I don’t understand where this gap can come from. Could you take a look at the mobile parse_input function?

@Treeesk Notice the length of argv is 3, which is incorrect and causes the gap.

The correct argv should look like this:

argv[0]: echo
argv[1]: world"insidequotestest"

Even though the highlighted " matches the first ", your parse_input function should not stop there for argv[1], because there is no space after the highlighted ".


Here’s a similar example from a previous stage #ni6 Single quotes:

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.