AGNOSTIC - UNIX Shell Javascript Emulation

For more information see the Agnostic Github Repository.

This is an early-alpha-stage project, which I hope one day will become the UNIX equivalent of online tutorials such as, CodeSchool, CodeAcademy, and others.

Try the following commands:
seq 5
seq -s, 0 5 100
ls -l
cut -f1,7 -d: < passwd
grep -iE '^(year|200[3-9])' nobel.csv | cut -f1,3 -d,
wc -l mammals.txt nobel.csv
printf "%d: %d\n" $(seq 7)
cal feb 2000
grep -q "sync" passwd && echo "found" || echo "not found"

echo $(dirname $FILE)/output/$(basename $FILE .md).html

export A=42 B=9
echo $((A/B))

date -d @$(($(date +%s)+86400)) +%A
test "$(date +%a)" = Fri && echo TGIF

The demo above emulates a basic UNIX environment, with one directory (/) and three text files (type ls -l to list them).

POSIX Shell Status

  • Currently implemented:
    • posix-compliant tokenizing, shell-quotes, field-splitting.
    • variable assignment (CC=clang)
    • parameter expansion ($HOME),
    • partial arithmetic expressions ($((42/9)))
    • Subshells (NAME=$(basename "$FILE" .txt))
    • Pipes (seq 10 | wc -l),
    • And/Or operations (make && echo ok || echo failed)
    • Sequential commands ( sleep 10 ; touch 1.txt )
    • Compound commands ( make || { echo make failed ; exit 1 ; } )
    • redirection (seq 10>hello.txt ; wc -l<hello.txt)
    • most control structures (if,for,while)
    • some Special built-in utilities ( export, readonly, set, unset).
    • Most arithmetic operators (e.g. $((9*6==42))
    • Parameter expansion string operations ( ${FOO:-BAR} )
    • Parameter expansion substitutions operations ( ${FOO##BAR} )
  • Not yet implemented:
    • filename-expansion
    • aliases
    • case control structure
    • multiline statements
    • Here-Documents

POSIX Utilities Status

  • (almost) fully implemented: basename, cal,cat, cut, date, dirname, echo, false, grep,head, paste, printf, seq, tac, tail, test, true, wc
  • not yet implemented (but planned): stat, env, find, xargs
  • Challenging but highly desired: sed, awk.

License and External Libraries

AGNOSTIC code is Copright (C) 2014 Assaf Gordon <>
Licensed as GPLv3 or later, with an additional permission to distribute the javascript files in a compressed/minified form, as explained here

AGNOSTIC uses the following libraries: