Skip to content

Commit f8b7278

Browse files
add bash
1 parent f3fc827 commit f8b7278

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ The input JSON payload expects two parameters: `language` and a `files` array wi
4747
```
4848

4949
## Languages Supported
50+
* Bash
5051
* C
5152
* C++
5253
* C#

language/bash/bash.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package bash
2+
3+
import (
4+
"github.com/coderbyte-org/cb-code-runner/cmd"
5+
"path/filepath"
6+
)
7+
8+
func Run(files []string, stdin string) (string, string, error) {
9+
workDir := filepath.Dir(files[0])
10+
return cmd.RunStdin(workDir, stdin, "bash", files[0])
11+
}

language/language.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"github.com/coderbyte-org/cb-code-runner/language/kotlin"
1515
"github.com/coderbyte-org/cb-code-runner/language/typescript"
1616
"github.com/coderbyte-org/cb-code-runner/language/clojure"
17+
"github.com/coderbyte-org/cb-code-runner/language/bash"
1718
)
1819

1920
type runFn func([]string, string) (string, string, error)
@@ -32,6 +33,7 @@ var languages = map[string]runFn{
3233
"kotlin": kotlin.Run,
3334
"typescript": typescript.Run,
3435
"clojure": clojure.Run,
36+
"bash": bash.Run,
3537
}
3638

3739
func IsSupported(lang string) bool {

0 commit comments

Comments
 (0)