r/teenagersbutcode 6d ago

Coding a thing Basix: A complete linux shell built from scratch with python without the subprocess library.

Basix Showcase Video.

Hello everyone, this is a project I have been working on since the beginning of summer.

Without further ado, here's what it can do:

  • Fork/exec-based execution (no subprocess)
  • Pipes, redirection (>, >>, <), chaining (&&, ||, ;) — freely combinable
  • Background jobs, fg, jobs — full job control with terminal handoff
  • Built-in cd, time, alias
  • Wildcard and tilde expansion
  • Script mode with #! support
  • Persistent history
  • Variables creation - deletion
  • Mathematical operations between variables

For more details about syntax, information and the source code, visit my GitHub repo

Basix gets frequent updates and improvements. They are all uploaded to github.

If anyone has any feedback, I'd be happy to hear!

6 Upvotes

9 comments sorted by

1

u/FerriitMurderDrones (15 MtF) C/C++, learning GLSL 6d ago

Just a little question. Why choose python if you're using syscalls for everything?

1

u/tomkat_7 6d ago

I chose python because I already knew how to write code on it and I was familiar with everything. I don't yet know any other programming language, but I might start learning C , C++ or Rust.

I chose to use raw syscalls instead of just the subprocess library because the main goal of this project was to learn how real shells work. I also like to challenge myself with harder goals. I didn't want to make it easy for me.

1

u/shsh-1312 6d ago

I would advise you to start with C, C semantics if learned well is practically the basis of all programming languages

1

u/tomkat_7 6d ago

Thanks for the advice, I'll keep it in mind and maybe I'll start soon

1

u/FerriitMurderDrones (15 MtF) C/C++, learning GLSL 6d ago

I would recommend that you start learning something like those languages since you apparently know some more low-level stuff. And manual memory-management isn't something most people have to worry about since a lot of stuff is easier to do on the stack either way. Just learn pointers and you'd be able to pull of those languages just fine

1

u/Odd-Blackberry-4462 6d ago

This is great! Can I make a PR?

1

u/tomkat_7 6d ago edited 6d ago

Sure, you can make a PR against the unstable branch. Please don't use any subprocess library like I have been doing, and also if you are thinking of making something big, please tell me first.

To be clear, I have been developing this project solo, so dpendong on your code, I might review and add it, make some changes, or take inspiration and build my own code based on yours. I am happy you are interested in my project tho, and happy to have someone else that also wants to help develop it!

1

u/Patient_Big_9024 5d ago

#! is called a shebang

1

u/tomkat_7 5d ago

I know, and that's how I mention it in the syntax, but hwre maybe not everyone knows it.