Skip to main content
deleted 136 characters in body
Source Link
Stéphane Chazelas
  • 584.8k
  • 96
  • 1.1k
  • 1.7k
    'echo' +"'[{<?php echo chr(13)?>php <?php echo PHP_VERSION.chr(10);exit;?>}\
    @GOTO DOS [exit[set 1 [[set 2 package] names];set 3 Tcl\ [info patchlevel];\
    if {[lsearch -exact $1 Expect]>=0} {puts expect\ [$2 require Expect]\ ($3)} \
    elseif {[lsearch -exact $1 Tk]>=0} {puts wish\ ($3,\ Tk\ [$2 require Tk])} \
    else {puts $3}]]]' >/dev/null ' {\">/dev/null \
    ">"/dev/null" +"\'";q="#{",1//2,"}";a=+1;q='''=.q,';q=%{\"
    'echo' /*>/dev/null
    echo ">/dev/null;status=0;@ {status=1};*=(" '$' ");~ $status 1&&{e='"\
    "';eval catch $2 ^'&version {eval ''echo <='^ $2 ^'&version''}';exit};e='"\
    "';if (eval '{let ''a^~a''} >[2] /dev/null'){e='"\
    "';exec echo akanga};eval exec echo rc $2 ^ version;\" > /dev/null
    : #;echo possibly pre-Bourne UNIX V1-6 shell;exit
    if (! $?version) set version=csh;exec echo $version
    :DOS
    @CLS
    @IF NOT "%DOSEMU_VERSION%"=="" ECHO DOSEMU %DOSEMU_VERSION%
    @ECHO %OS% %COMSPEC%
    @VER
    @GOTO FIN
    ", unless eval 'printf "perl %vd\n",$^V;exit;'> "/dev/null";eval ': "\'';
    =S"';f=false e=exec\ echo n=/dev/null v=SH_VERSION;`(eval "f() { echo :
    };f")2>$n` $f||$e Bourne-like shell without function
    case `(: ${_z_?1}) 2>&1` in 1) $e ash/BSD sh;;esac;t(){
    eval "\${$1$v+:} $f &&exec echo ${2}sh \$$1$v";};t BA ba;t Z z;t PO po;t YA ya
    case `(typeset -Z2 b=0;$e $b)2>$n` in 00) (eval ':${.}')2>$n&&eval '
    $e ksh93 ${.sh.version}';t K pdk;$e ksh88;;esac;case `(eval '$e ${f#*s}$($e 1
    )$((1+1))')2>$n` in e12)$e POSIX shell;;esac;$e Bourne-like shell;: }
    print "ruby ",RUBY_VERSION,"\n";exit;' ''';import sys
    print("python "+sys.version);z='''*/;
    s="";j="JavaScript";if(typeof process=="object"){p=console.log;p(process.title
    ,process.version)}else{p=print;p((f="function")==(t=typeof version)?"string"==
    typeof(v=version())?v:(typeof build!=f?"":s= "SpiderMonkey ")+j+" "+v:(t==
    "undefined"?j+"?":version)+"\n");if(s)build()}/*
    :FIN } *///'''
    'echo' +"'[{<?php echo chr(13)?>php <?php echo PHP_VERSION.chr(10);exit;?>}\
    @GOTO DOS [exit[set 1 [[set 2 package] names];set 3 Tcl\ [info patchlevel];\
    if {[lsearch -exact $1 Expect]>=0} {puts expect\ [$2 require Expect]\ ($3)} \
    elseif {[lsearch -exact $1 Tk]>=0} {puts wish\ ($3,\ Tk\ [$2 require Tk])} \
    else {puts $3}]]]' >/dev/null ' {\">/dev/null \
    ">"/dev/null" +"\'";q="#{",1//2,"}";a=+1;q='''=.q,';q=%{\"
    'echo' /*>/dev/null
    echo ">/dev/null;status=0;@ {status=1};*=(" '$' ");~ $status 1&&{e='"\
    "';eval catch $2 ^'&version {eval ''echo <='^ $2 ^'&version''}';exit};e='"\
    "';if (eval '{let ''a^~a''} >[2] /dev/null'){e='"\
    "';exec echo akanga};eval exec echo rc $2 ^ version;\" > /dev/null
    : #;echo possibly pre-Bourne UNIX V1-6 shell;exit
    if (! $?version) set version=csh;exec echo $version
    :DOS
    @CLS
    @IF NOT "%DOSEMU_VERSION%"=="" ECHO DOSEMU %DOSEMU_VERSION%
    @ECHO %OS% %COMSPEC%
    @VER
    @GOTO FIN
    ", unless eval 'printf "perl %vd\n",$^V;exit;'> "/dev/null";eval ': "\'';
    =S"';f=false e=exec\ echo n=/dev/null v=SH_VERSION;`(eval "f() { echo :
    };f")2>$n` $f||$e Bourne-like shell without function
    case `(: ${_z_?1}) 2>&1` in 1) $e ash/BSD sh;;esac;t(){
    eval "\${$1$v+:} $f &&exec echo ${2}sh \$$1$v";};t BA ba;t Z z;t PO po;t YA ya
    case `(typeset -Z2 b=0;$e $b)2>$n` in 00) (eval ':${.}')2>$n&&eval '
    $e ksh93 ${.sh.version}';t K pdk;$e ksh88;;esac;case `(eval '$e ${f#*s}$($e 1
    )$((1+1))')2>$n` in e12)$e POSIX shell;;esac;$e Bourne-like shell;: }
    print "ruby ",RUBY_VERSION,"\n";exit;' ''';import sys
    print("python "+sys.version);z='''*/;
    s="";j="JavaScript";if(typeof process=="object"){p=console.log;p(process.title
    ,process.version)}else{p=print;p((f="function")==(t=typeof version)?"string"==
    typeof(v=version())?v:(typeof build!=f?"":s= "SpiderMonkey ")+j+" "+v:(t==
    "undefined"?j+"?":version)+"\n");if(s)build()}/*
    :FIN } *///'''
'echo' +"'[{<?php echo chr(13)?>php <?php echo PHP_VERSION.chr(10);exit;?>}\
@GOTO DOS [exit[set 1 [[set 2 package] names];set 3 Tcl\ [info patchlevel];\
if {[lsearch -exact $1 Expect]>=0} {puts expect\ [$2 require Expect]\ ($3)} \
elseif {[lsearch -exact $1 Tk]>=0} {puts wish\ ($3,\ Tk\ [$2 require Tk])} \
else {puts $3}]]]' >/dev/null ' {\">/dev/null \
">"/dev/null" +"\'";q="#{",1//2,"}";a=+1;q='''=.q,';q=%{\"
'echo' /*>/dev/null
echo ">/dev/null;status=0;@ {status=1};*=(" '$' ");~ $status 1&&{e='"\
"';eval catch $2 ^'&version {eval ''echo <='^ $2 ^'&version''}';exit};e='"\
"';if (eval '{let ''a^~a''} >[2] /dev/null'){e='"\
"';exec echo akanga};eval exec echo rc $2 ^ version;\" > /dev/null
: #;echo possibly pre-Bourne UNIX V1-6 shell;exit
if (! $?version) set version=csh;exec echo $version
:DOS
@CLS
@IF NOT "%DOSEMU_VERSION%"=="" ECHO DOSEMU %DOSEMU_VERSION%
@ECHO %OS% %COMSPEC%
@VER
@GOTO FIN
", unless eval 'printf "perl %vd\n",$^V;exit;'> "/dev/null";eval ': "\'';
=S"';f=false e=exec\ echo n=/dev/null v=SH_VERSION;`(eval "f() { echo :
};f")2>$n` $f||$e Bourne-like shell without function
case `(: ${_z_?1}) 2>&1` in 1) $e ash/BSD sh;;esac;t(){
eval "\${$1$v+:} $f &&exec echo ${2}sh \$$1$v";};t BA ba;t Z z;t PO po;t YA ya
case `(typeset -Z2 b=0;$e $b)2>$n` in 00) (eval ':${.}')2>$n&&eval '
$e ksh93 ${.sh.version}';t K pdk;$e ksh88;;esac;case `(eval '$e ${f#*s}$($e 1
)$((1+1))')2>$n` in e12)$e POSIX shell;;esac;$e Bourne-like shell;: }
print "ruby ",RUBY_VERSION,"\n";exit;' ''';import sys
print("python "+sys.version);z='''*/;
s="";j="JavaScript";if(typeof process=="object"){p=console.log;p(process.title
,process.version)}else{p=print;p((f="function")==(t=typeof version)?"string"==
typeof(v=version())?v:(typeof build!=f?"":s= "SpiderMonkey ")+j+" "+v:(t==
"undefined"?j+"?":version)+"\n");if(s)build()}/*
:FIN } *///'''
Formatted list
Source Link
Stéphane Chazelas
  • 584.8k
  • 96
  • 1.1k
  • 1.7k
  1. Thompson shell (osh),
  2. Bourne shell,
  3. Bourne-again shell (bash),
  4. Korn shell (ksh88, ksh93, pdksh, mksh),
  5. zsh,
  6. Policy-compliant Ordinary shell (posh),
  7. Yet Another shell (yash),
  8. rc shell,
  9. akanga shell,
  10. es shellsshell,
  11. wish TCL interpreter,
  12. tclsh TCL interpreter,
  13. expect TCL interpreter,
  14. Perl,
  15. Python,
  16. Ruby,
  17. PHP,
  18. JavaScript (nodejs, SpiderMonkey shell and JSPL at least)
  19. MS/Wine cmd.execmd.exe, command.comcommand.com (MSDOS, FreeDOS...).
  1. Thompson (osh),
  2. Bourne,
  3. Bourne-again (bash),
  4. Korn (ksh88, ksh93, pdksh, mksh),
  5. zsh,
  6. Policy-compliant Ordinary (posh),
  7. Yet Another (yash),
  8. rc,
  9. akanga
  10. es shells
  11. wish
  12. tclsh
  13. expect
  14. Perl
  15. Python
  16. Ruby
  17. PHP
  18. JavaScript (nodejs, SpiderMonkey shell and JSPL at least)
  19. MS/Wine cmd.exe, command.com (MSDOS, FreeDOS...).
  1. Thompson shell (osh),
  2. Bourne shell,
  3. Bourne-again shell (bash),
  4. Korn shell (ksh88, ksh93, pdksh, mksh),
  5. zsh,
  6. Policy-compliant Ordinary shell (posh),
  7. Yet Another shell (yash),
  8. rc shell,
  9. akanga shell,
  10. es shell,
  11. wish TCL interpreter,
  12. tclsh TCL interpreter,
  13. expect TCL interpreter,
  14. Perl,
  15. Python,
  16. Ruby,
  17. PHP,
  18. JavaScript (nodejs, SpiderMonkey shell and JSPL at least)
  19. MS/Wine cmd.exe, command.com (MSDOS, FreeDOS...).

Maybe not what you're asking for, but this should work to some extent to identify the interpreter currently interpreting it for a few like Thompson (osh), Bourne, Bourne-again (bash), Korn (ksh88, ksh93, pdksh, mksh), zsh, Policy-compliant Ordinary (posh), Yet Another (yash), rc, akanga, es shells, wish, tclsh, expect, perl, python, ruby, php, JavaScript (nodejs, SpiderMonkey shell and JSPL at least), MS/Wine cmd.exe, command.com (MSDOS, FreeDOS...).

  1. Thompson (osh),
  2. Bourne,
  3. Bourne-again (bash),
  4. Korn (ksh88, ksh93, pdksh, mksh),
  5. zsh,
  6. Policy-compliant Ordinary (posh),
  7. Yet Another (yash),
  8. rc,
  9. akanga
  10. es shells
  11. wish
  12. tclsh
  13. expect
  14. Perl
  15. Python
  16. Ruby
  17. PHP
  18. JavaScript (nodejs, SpiderMonkey shell and JSPL at least)
  19. MS/Wine cmd.exe, command.com (MSDOS, FreeDOS...).
    'echo' +"'[{<?php echo chr(13)?>php <?php echo PHP_VERSION.chr(10);exit;?>}\
    @GOTO DOS [exit[set 1 [[set 2 package] names];set 3 Tcl\ [info patchlevel];\
    if {[lsearch -exact $1 Expect]>=0} {puts expect\ [$2 require Expect]\ ($3)} \
    elseif {[lsearch -exact $1 Tk]>=0} {puts wish\ ($3,\ Tk\ [$2 require Tk])} \
    else {puts $3}]]]' >/dev/null ' {\">/dev/null \
    ">"/dev/null" +"\'";q="#{",1//2,"}";a=+1;q='''=.q,';q=%{\"
    'echo' /*>/dev/null
    echo ">/dev/null;status=0;@ {status=1};*=(" '$' ");~ $status 1&&{e='"\
    "';eval catch $2 ^'&version {eval ''echo <='^ $2 ^'&version''}';exit};e='"\
    "';if (eval '{let ''a^~a''} >[2] /dev/null'){e='"\
    "';exec echo akanga};eval exec echo rc $2 ^ version;\" > /dev/null
    : #;echo possibly pre-Bourne UNIX V1-6 shell;exit
    if (! $?version) set version=csh;exec echo $version
    :DOS
    @CLS
    @IF NOT "%DOSEMU_VERSION%"=="" ECHO DOSEMU %DOSEMU_VERSION%
    @ECHO %OS% %COMSPEC%
    @VER
    @GOTO FIN
    ", unless eval 'printf "perl %vd\n",$^V;exit;'> "/dev/null";eval ': "\'';
    =S"';f=false e=exec\ echo n=/dev/null v=SH_VERSION;`(eval "f() { echo :
    };f")2>$n` $f||$e Bourne-like shell without function
    case `(: ${_z_?1}) 2>&1` in 1) $e ash/BSD sh;;esac;t(){
    eval "\${$1$v+:} $f &&exec echo ${2}sh \$$1$v";};t BA ba;t Z z;t PO po;t YA ya
    case `(typeset -Z2 b=0;$e $b)2>$n` in 00) (eval ':${.}')2>$n&&eval '
    $e ksh93 ${.sh.version}';t K pdk;$e ksh88;;esac;case `(eval '$e ${f#*s}$($e 1
    )$((1+1))')2>$n` in e12)$e POSIX shell;;esac;$e Bourne-like shell;: }
    print "ruby ",RUBY_VERSION,"\n";exit;' ''';import sys
    print("python "+sys.version);z='''*/;
    s="";j="JavaScript";if(typeof process=="object"){p=console.log;p(process.title
    ,process.version)}else{p=print;p((f="function")==(t=typeof version)?"string"==
    typeof(v=version())?v:(typeof build!=f?"":s= "SpiderMonkey ")+j+" "+v:(t==
    "undefined"?j+"?":version)+"\n");if(s)build()}/*
    :FIN } *///'''

Maybe not what you're asking for, but this should work to some extent to identify the interpreter currently interpreting it for a few like Thompson (osh), Bourne, Bourne-again (bash), Korn (ksh88, ksh93, pdksh, mksh), zsh, Policy-compliant Ordinary (posh), Yet Another (yash), rc, akanga, es shells, wish, tclsh, expect, perl, python, ruby, php, JavaScript (nodejs, SpiderMonkey shell and JSPL at least), MS/Wine cmd.exe, command.com (MSDOS, FreeDOS...).

'echo' +"'[{<?php echo chr(13)?>php <?php echo PHP_VERSION.chr(10);exit;?>}\
@GOTO DOS [exit[set 1 [[set 2 package] names];set 3 Tcl\ [info patchlevel];\
if {[lsearch -exact $1 Expect]>=0} {puts expect\ [$2 require Expect]\ ($3)} \
elseif {[lsearch -exact $1 Tk]>=0} {puts wish\ ($3,\ Tk\ [$2 require Tk])} \
else {puts $3}]]]' >/dev/null ' {\">/dev/null \
">"/dev/null" +"\'";q="#{",1//2,"}";a=+1;q='''=.q,';q=%{\"
'echo' /*>/dev/null
echo ">/dev/null;status=0;@ {status=1};*=(" '$' ");~ $status 1&&{e='"\
"';eval catch $2 ^'&version {eval ''echo <='^ $2 ^'&version''}';exit};e='"\
"';if (eval '{let ''a^~a''} >[2] /dev/null'){e='"\
"';exec echo akanga};eval exec echo rc $2 ^ version;\" > /dev/null
: #;echo possibly pre-Bourne UNIX V1-6 shell;exit
if (! $?version) set version=csh;exec echo $version
:DOS
@CLS
@IF NOT "%DOSEMU_VERSION%"=="" ECHO DOSEMU %DOSEMU_VERSION%
@ECHO %OS% %COMSPEC%
@VER
@GOTO FIN
", unless eval 'printf "perl %vd\n",$^V;exit;'> "/dev/null";eval ': "\'';
=S"';f=false e=exec\ echo n=/dev/null v=SH_VERSION;`(eval "f() { echo :
};f")2>$n` $f||$e Bourne-like shell without function
case `(: ${_z_?1}) 2>&1` in 1) $e ash/BSD sh;;esac;t(){
eval "\${$1$v+:} $f &&exec echo ${2}sh \$$1$v";};t BA ba;t Z z;t PO po;t YA ya
case `(typeset -Z2 b=0;$e $b)2>$n` in 00) (eval ':${.}')2>$n&&eval '
$e ksh93 ${.sh.version}';t K pdk;$e ksh88;;esac;case `(eval '$e ${f#*s}$($e 1
)$((1+1))')2>$n` in e12)$e POSIX shell;;esac;$e Bourne-like shell;: }
print "ruby ",RUBY_VERSION,"\n";exit;' ''';import sys
print("python "+sys.version);z='''*/;
s="";j="JavaScript";if(typeof process=="object"){p=console.log;p(process.title
,process.version)}else{p=print;p((f="function")==(t=typeof version)?"string"==
typeof(v=version())?v:(typeof build!=f?"":s= "SpiderMonkey ")+j+" "+v:(t==
"undefined"?j+"?":version)+"\n");if(s)build()}/*
:FIN } *///'''

Maybe not what you're asking for, but this should work to some extent to identify the interpreter currently interpreting it for a few like

  1. Thompson (osh),
  2. Bourne,
  3. Bourne-again (bash),
  4. Korn (ksh88, ksh93, pdksh, mksh),
  5. zsh,
  6. Policy-compliant Ordinary (posh),
  7. Yet Another (yash),
  8. rc,
  9. akanga
  10. es shells
  11. wish
  12. tclsh
  13. expect
  14. Perl
  15. Python
  16. Ruby
  17. PHP
  18. JavaScript (nodejs, SpiderMonkey shell and JSPL at least)
  19. MS/Wine cmd.exe, command.com (MSDOS, FreeDOS...).
    'echo' +"'[{<?php echo chr(13)?>php <?php echo PHP_VERSION.chr(10);exit;?>}\
    @GOTO DOS [exit[set 1 [[set 2 package] names];set 3 Tcl\ [info patchlevel];\
    if {[lsearch -exact $1 Expect]>=0} {puts expect\ [$2 require Expect]\ ($3)} \
    elseif {[lsearch -exact $1 Tk]>=0} {puts wish\ ($3,\ Tk\ [$2 require Tk])} \
    else {puts $3}]]]' >/dev/null ' {\">/dev/null \
    ">"/dev/null" +"\'";q="#{",1//2,"}";a=+1;q='''=.q,';q=%{\"
    'echo' /*>/dev/null
    echo ">/dev/null;status=0;@ {status=1};*=(" '$' ");~ $status 1&&{e='"\
    "';eval catch $2 ^'&version {eval ''echo <='^ $2 ^'&version''}';exit};e='"\
    "';if (eval '{let ''a^~a''} >[2] /dev/null'){e='"\
    "';exec echo akanga};eval exec echo rc $2 ^ version;\" > /dev/null
    : #;echo possibly pre-Bourne UNIX V1-6 shell;exit
    if (! $?version) set version=csh;exec echo $version
    :DOS
    @CLS
    @IF NOT "%DOSEMU_VERSION%"=="" ECHO DOSEMU %DOSEMU_VERSION%
    @ECHO %OS% %COMSPEC%
    @VER
    @GOTO FIN
    ", unless eval 'printf "perl %vd\n",$^V;exit;'> "/dev/null";eval ': "\'';
    =S"';f=false e=exec\ echo n=/dev/null v=SH_VERSION;`(eval "f() { echo :
    };f")2>$n` $f||$e Bourne-like shell without function
    case `(: ${_z_?1}) 2>&1` in 1) $e ash/BSD sh;;esac;t(){
    eval "\${$1$v+:} $f &&exec echo ${2}sh \$$1$v";};t BA ba;t Z z;t PO po;t YA ya
    case `(typeset -Z2 b=0;$e $b)2>$n` in 00) (eval ':${.}')2>$n&&eval '
    $e ksh93 ${.sh.version}';t K pdk;$e ksh88;;esac;case `(eval '$e ${f#*s}$($e 1
    )$((1+1))')2>$n` in e12)$e POSIX shell;;esac;$e Bourne-like shell;: }
    print "ruby ",RUBY_VERSION,"\n";exit;' ''';import sys
    print("python "+sys.version);z='''*/;
    s="";j="JavaScript";if(typeof process=="object"){p=console.log;p(process.title
    ,process.version)}else{p=print;p((f="function")==(t=typeof version)?"string"==
    typeof(v=version())?v:(typeof build!=f?"":s= "SpiderMonkey ")+j+" "+v:(t==
    "undefined"?j+"?":version)+"\n");if(s)build()}/*
    :FIN } *///'''
added support for nodejs
Source Link
Stéphane Chazelas
  • 584.8k
  • 96
  • 1.1k
  • 1.7k
Loading
added 1 character in body
Source Link
Stéphane Chazelas
  • 584.8k
  • 96
  • 1.1k
  • 1.7k
Loading
get latest version
Source Link
Stéphane Chazelas
  • 584.8k
  • 96
  • 1.1k
  • 1.7k
Loading
restore `es` that had been broken by the javascript code.
Source Link
Stéphane Chazelas
  • 584.8k
  • 96
  • 1.1k
  • 1.7k
Loading
add jspl, fixed and improved command.com/cmd.exe ones, condensed the TCL part. Added the script to github.
Source Link
Stéphane Chazelas
  • 584.8k
  • 96
  • 1.1k
  • 1.7k
Loading
Bounty Awarded with 500 reputation awarded by Gilles 'SO- stop being evil'
added 382 characters in body
Source Link
Stéphane Chazelas
  • 584.8k
  • 96
  • 1.1k
  • 1.7k
Loading
added yash and smjs
Source Link
Stéphane Chazelas
  • 584.8k
  • 96
  • 1.1k
  • 1.7k
Loading
add php
Source Link
Stéphane Chazelas
  • 584.8k
  • 96
  • 1.1k
  • 1.7k
Loading
adapt to posh and newer pdksh
Source Link
Stéphane Chazelas
  • 584.8k
  • 96
  • 1.1k
  • 1.7k
Loading
added python3 support
Source Link
Stéphane Chazelas
  • 584.8k
  • 96
  • 1.1k
  • 1.7k
Loading
Source Link
Stéphane Chazelas
  • 584.8k
  • 96
  • 1.1k
  • 1.7k
Loading