I wonder is there any program that can take a bash script as input and print out all bash commands it will run? A program that would unroll loops, expand environment variables and generally not perform any destructive action nor call any external binaries. It’s like a dry run of sorts.
yeah i think a sandbox would be the best solution.
Depending on what script OP is trying to run it would be best to just “rebuild” the potentially affected part of your system inside a VM and see what happens.