Run Bash Online
Write and run Bash scripts in the browser, great for learning, practice, and quick checks.
Bash Script Editor
Output
Standard output (stdout)
Standard error (stderr)
Execution info
Exit code:
Run status:
Usage
- Write Bash scripts in the left editor (optionally starting with
#!/usr/bin/env bash). - Click "Run Code" to execute the script online.
- The right panel shows output and errors.
- The green area is standard output (e.g.,
echooutput). - The red area shows runtime errors and messages.
- Execution info includes exit code and run status.
- Shortcut:
Ctrl+Enter(Cmd+Enter on Mac).
Bash Basics
Basic structure:
#!/usr/bin/env bash
echo "Hello, Bash!"
echo "Hello, Bash!"
Variables and substitution:
name="Alice"
echo "Hello, $name"
echo "Files: " ${#*}
echo "Hello, $name"
echo "Files: " ${#*}
Control Flow
Conditionals and loops:
x=3
if [ $x -gt 2 ]; then echo ">2"; else echo "<=2"; fi
for i in {1..3}; do echo $i; done
if [ $x -gt 2 ]; then echo ">2"; else echo "<=2"; fi
for i in {1..3}; do echo $i; done
Functions and Script Organization
Function example:
greet() { echo "Hello, $1"; }
greet Bash
greet Bash
FAQ
Which Bash versions are supported?
Typically newer Bash versions are supported; the exact version depends on the backend environment.
Can I use external programs?
The runtime is sandboxed; only limited system commands are allowed and network access is unavailable.
Is there a time limit for execution?
Yes. To avoid infinite loops and ensure fair use, execution is time-limited and will be terminated on timeout.
Can I save scripts?
Online saving is not supported yet. Copy important scripts locally or save snippets in bookmarks/notes.
Is interactive input supported?
Interactive input (e.g., read) is not supported currently. For testing, hardcode input in the script or use fixed data instead.
Example scripts (click Run above)
1. Print 1..5
for i in {1..5}; do echo $i; done
2. Functions and parameters
greet() { echo "Hello, $1"; }
greet World
greet World