What You’ll Learn
- Running shell commands for system info
- Running Python one-liners and multi-line scripts
- Writing scripts to the sandbox filesystem and executing them
- Using shell pipelines (
sort,uniq, etc.) - All within a single sandbox session
- Proper cleanup with
try/finallyandsbx.kill()
Prerequisites
This example is available in Python. TypeScript version coming soon.
Code Walkthrough
Shell commands — run any system utility directly:python3 -c for quick computations:
sbx.files.write() to upload code, then run it:
.sh file and run it with sh: