diff options
Diffstat (limited to 'wide_compiler.sh')
-rwxr-xr-x | wide_compiler.sh | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/wide_compiler.sh b/wide_compiler.sh new file mode 100755 index 0000000..dfbd6f5 --- /dev/null +++ b/wide_compiler.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +FILE=$(readlink -f "$1") +DIR=$(dirname "$FILE") +BASE="${FILE%.*}" +SHEBANG=$(sed -n 1p "$FILE") + +cd "$DIR" || exit + +shebangtest() { + case "$SHEBANG" in + \#\!*) "$FILE" ;; + *) sent "$FILE" 2>/dev/null & ;; + esac +} + +case "$FILE" in + *\.c) cc "$FILE" -o "$BASE" && "$BASE" ;; + *\.py) python "$FILE" ;; + *\.go) go run "$FILE" ;; + *) shebangtest ;; +esac + +notify-send "$FILE" + |