XCODX |

Dash Online Compiler & Interpreter

Select Language
Online Code Compiler
Full HTML IDE
Py main.py
Program Output Ready
  Welcome to XCODX Online Compiler

  Quick Start:
  Ctrl+Enter  Run code
  Ctrl+S      Save / Download
  Ctrl+L      Clear output

  Select a language and start coding.
Success
Operation completed

About Dash

When Debian or Ubuntu runs /bin/sh, the shell doing the work is Dash — the Debian Almquist Shell. It exists for two reasons: speed and strict POSIX compliance. Dash starts noticeably faster than Bash, which is why distributions use it for boot scripts and system scripting, and it deliberately omits Bash extensions like arrays and [[ ]], which makes it the honest test of whether your script is truly portable. If code runs in Dash, it will run on almost any Unix shell, from Alpine containers to BusyBox routers. Use the interactive terminal on this page to run POSIX shell scripts live — read prompts wait for your actual keystrokes, and there is nothing to install.

Hello World in Dash

#!/bin/sh
printf "Enter your name: "
read name
echo "Hello, $name!"

printf "Enter a whole number: "
read n

i=1
sum=0
while [ "$i" -le "$n" ]; do
    sum=$((sum + i))
    i=$((i + 1))
done
echo "Sum of 1..$n is $sum"

case $sum in
    *[02468]) echo "That total is even." ;;
    *)        echo "That total is odd." ;;
esac

When to use Dash

Dash matters most when portability does: writing Docker entrypoint scripts for Alpine images, maintaining Debian package maintainer scripts, or authoring anything with a #!/bin/sh shebang that must survive on minimal systems. It is the right place to check whether a script leans on Bashisms — paste it here and the errors tell you immediately. Students in operating systems or Unix tools courses also benefit, because POSIX sh is the dialect textbooks and exams assume. Practicing read loops, case statements, and $((...)) arithmetic here builds shell skills that transfer everywhere.

Common questions

Can I respond to read prompts while the script runs?

Yes. read pauses the script and waits for a line from the terminal, and since this is a live interactive session your typed input flows straight to stdin. printf prompts render before the pause, so interactive scripts feel exactly like they do over SSH on a real server.

How is Dash different from Bash?

Dash implements the POSIX shell specification and little more. Bash features like arrays, [[ ]] conditionals, (( )) arithmetic commands, process substitution, and ${var//replace} expansions will fail in Dash. In exchange, Dash is smaller and faster, which is why Debian and Ubuntu point /bin/sh at it. Scripts that pass in Dash are highly portable.

Why does my script fail here but work on my machine?

Almost always a Bashism: your local sh may secretly be Bash. Common culprits are echo -e, source instead of ., ==, arrays, and $RANDOM. Replace them with POSIX equivalents — printf, . file, =, positional parameters or set --, and awk or /dev/urandom for randomness.

How Dash runs on XCODX

Sandbox filename
main.sh
Entry point
single main source file
Editor grammar
shell
Reading stdin
read
Input delivery
live WebSocket stream
Prompt flushing
flushes before reading input
Compile limit
10 s
Run limit
3 s batch · up to 3 min live
Memory
256 MB per stage
Max source
50,000 characters

Default program on this page

#!/bin/dash
# Dash - Debian Almquist Shell
echo "Hello from Dash!"
echo "Welcome to XCODX Online Compiler!"

# Variables and arithmetic
COUNT=5
echo "Counting to $COUNT:"
I=1
while [ "$I" -le "$COUNT" ]; do
    echo "  Number: $I"
    I=$((I + 1))
done
echo "Done!"