Skip to content

Repository files navigation

cbexec

A universal shebang wrapper (and gross hack), switching interpreters based on file extension.


Examples

Bash

#!/usr/bin/env cbexecbuiltinprintf'%s\n' \
"Hello Bash World!"

C

#!/usr/bin/env cbexec
#include <stdio.h>intmain() {
printf("Hello C World!\n");
return0;
}

COBOL

#!/usr/bin/env cbexec
IDENTIFICATION DIVISION.
PROGRAM-ID. COBOL.
PROCEDURE DIVISION.
MAIN.
DISPLAY 'HELLO COBOL WORLD!' END-DISPLAY.
STOP RUN.

C++

#!/usr/bin/env cbexec
#include <iostream>intmain()
{
std::cout <<"Hello C++ World!"<< std::endl;
return0;
}

C Shell

#!/usr/bin/env cbexecset fignore = (.o \~) &&set hw='Hello C Shell World!'&&printf'%s\n'"$hw";

D

#!/usr/bin/env cbexecimportstd.stdio;
intmain() {
writeln("Hello D World!");
return0;
}

Emacs Lisp

#!/usr/bin/env cbexec
(message"Hello Emacs Lisp World!")

FORTRAN-90

#!/usr/bin/env cbexec
program main
implicit none
write (*, '(a)') 'Hello FORTRAN-90 World!'
stop
end

FORTRAN-77

#!/usr/bin/env cbexec
PROGRAM HELLOW
WRITE(UNIT=*,FMT='(A)')'HELLO FORTRAN-77 WORLD!'
STOP
END

Go

#!/usr/bin/env cbexec
package main
import "fmt"
func main() {
fmt.Println("Hello Go World!")
}

Korn Shell

#!/usr/bin/env cbexec
PATH=""
print "Hello Korn Shell World!"

MATLAB / Octave

#!/usr/bin/env cbexec
printf("Hello MATLAB World!\n");
quit(0);

OCaml

#!/usr/bin/env cbexec
print_sring "Hello OCaml World!\n"

'"POSIX"' Shell

#!/usr/bin/env cbexec
(
exec2> /dev/null
time1> /dev/null 2>&1< /dev/null
) || {
XX="Hello POSIX Shell World!":printf'%s\n'"$XX"
} | grep POSIX

Z Shell

#!/usr/bin/env cbexec
PATH=""
- builtin print "Hello Z Shell World!"

About

cbexec: A universal shebang wrapper, switching based on file extension

Topics

Resources

Stars

2 stars

Watchers

1 watching

Forks

Used by

Contributors

Languages