How can I create a safe testing environment for my shell scripts?

September 24, 2025 1 answer
Asked by QuirkyPanda74
I'm looking for ways to set up an isolated environment to test my shell scripts. I need to ensure they can run without failing if certain non-standard commands are missing (like `qemu-system-*`). While I initially thought of using tools like `schroot`, `docker`, or `lxd`, I'm also considering modifying environment variables, such as `PATH`, to mimic the absence of these commands. However, protecting my file system during testing is crucial since I want to avoid any accidental commands like `sudo rm -rf --no-preserve-root /`. What do you all think?

Answers

ChillGiraffe88
Have you thought about using containers? They're great for isolating your environment without the overhead of creating a full virtual machine.
Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions