Bash

Run Bash 5.2 online

Execute Bash scripts instantly in a secure, isolated sandbox. No server access needed. Test your shell scripts safely online.

script.sh
Output
Click "Run Code" to execute...

About Bash

Bash is the default shell on most Linux and macOS systems, essential for shell scripting, automation, DevOps pipelines, and system administration. It provides powerful text processing, file manipulation, and process management capabilities.

Our sandbox runs Bash 5.2 with common GNU utilities available.

Sandbox features

  • Secure execution with Docker + gVisor isolation
  • Bash 5.2 with GNU coreutils
  • Sync/stream: Basic 30s, Pro 60s, Ultra/Mega 150s; async: Ultra 300s, Mega 600s
  • Stdin support for interactive scripts
  • REST API for programmatic access
  • No setup or installation required

Use Bash with stateful sessions

Open a session once, then call execute repeatedly. Files written under /home/sandbox persist between calls; each call starts a fresh process, so variables do not carry over. Package install is available for Python (pip) and JavaScript/TypeScript (npm) sessions only.

# 1. Create a session (PRO, ULTRA, or MEGA)
curl -X POST https://sandboxapi.p.rapidapi.com/v1/sessions \
  -H "X-RapidAPI-Key: $RAPIDAPI_KEY" \
  -H "X-RapidAPI-Host: sandboxapi.p.rapidapi.com" \
  -H "Content-Type: application/json" \
  -d '{"language":"bash","idle_ttl":300}'
# → {"id":"sess_abc","language":"bash",...}

# 2. Write a file in the session
curl -X POST https://sandboxapi.p.rapidapi.com/v1/sessions/sess_abc/execute \
  -H "X-RapidAPI-Key: $RAPIDAPI_KEY" \
  -H "X-RapidAPI-Host: sandboxapi.p.rapidapi.com" \
  -H "Content-Type: application/json" \
  -d '{"code":"echo 42 > /home/sandbox/state.txt"}'

# 3. A later call reads it back: files persist, variables do not
curl -X POST https://sandboxapi.p.rapidapi.com/v1/sessions/sess_abc/execute \
  -H "X-RapidAPI-Key: $RAPIDAPI_KEY" \
  -H "X-RapidAPI-Host: sandboxapi.p.rapidapi.com" \
  -H "Content-Type: application/json" \
  -d '{"code":"echo $(( $(cat /home/sandbox/state.txt) * 2 ))"}'
Read the sessions docs →

Need more? Get API access

Integrate secure code execution into your own apps with our REST API. Basic includes 500 requests per RapidAPI subscription period.