# Stuck at a problem in build your own shell

**URL:** <https://forum.codecrafters.io/t/stuck-at-a-problem-in-build-your-own-shell/15943>\
**Category:** Challenges\
**Tags:** challenge:shell\
**Created:** [February 26, 2026, 11:06am UTC](https://forum.codecrafters.io/t/stuck-at-a-problem-in-build-your-own-shell/15943 "2026-02-26T11:06:24Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![SaahilDadhania](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/saahildadhania/32/23635_2.png) [@SaahilDadhania](https://forum.codecrafters.io/u/SaahilDadhania)\
**Post date:** [February 26, 2026, 11:06am UTC](https://forum.codecrafters.io/t/stuck-at-a-problem-in-build-your-own-shell/15943/1 "2026-02-26T11:06:24Z")

</div>

I’m stuck on Stage #(change to your stage, ex. #JM3).

I’ve tried THE CODE IN THE CODE EXAMPLE GIVEN still its not working

Here are my logs:

```auto
[tester::#MG5] Running ./your_program.sh
[your-program] $ type cat
[your-program] cat: not found
[tester::#MG5] ^ Line does not match expected value.
[tester::#MG5] Expected: "cat is /bin/cat"
[tester::#MG5] Received: "cat: not found"
[your-program] $ 
[tester::#MG5] Test failed

```

And here’s a snippet of my code:

```python
import sys
import shutil

builtin_commands = ["echo", "exit", "type"]

def main():
    while True:
        sys.stdout.write("$ ")
        command = input()
        if command.startswith("exit"):
            break
        elif command.startswith("echo"):
            print(command[5:])
        elif command.startswith("type"):
            if command[5:] in builtin_commands:
                print(f"{command[5:]} is a shell builtin")
            elif path := shutil.which(command[5:]):
                print(f"{command[5:]} is {path}")
            else:
                print(f"{command[5:]}: not found")
        else:
            print(f"{command}: command not found")

if __name__ == " __main__":
    main()

```

---

<div class="post-metadata">

**Author:** ![SaahilDadhania](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/saahildadhania/32/23635_2.png) [@SaahilDadhania](https://forum.codecrafters.io/u/SaahilDadhania)\
**Post date:** [February 26, 2026, 12:08pm UTC](https://forum.codecrafters.io/t/stuck-at-a-problem-in-build-your-own-shell/15943/2 "2026-02-26T12:08:59Z")

</div>

never mind , solved the issue

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/3X/7/0/700657133935c15703e22c7c8870394f6e6dc27d.svg) [@system](https://forum.codecrafters.io/u/system)\
**Post date:** [March 3, 2026, 12:09pm UTC](https://forum.codecrafters.io/t/stuck-at-a-problem-in-build-your-own-shell/15943/3 "2026-03-03T12:09:53Z")

</div>

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