nix-system/bin/quickrun.fish
2024-06-03 15:26:27 +02:00

19 lines
302 B
Fish
Executable file

#!/usr/bin/env nix-shell
#!nix-shell -i fish
#!nix-shell -p fish gcc
set file (realpath $argv[1])
set workdir (mktemp -d)
cd $workdir
set extension (string match -r '\.([a-z]+)$' $file | head -n 1)
switch $extension
case ".c"
gcc -o a.out $file
./a.out
case ".py"
python $file
end