From 2f38bc640c1c524f42eb0f9d14b11aa1f3d574e1 Mon Sep 17 00:00:00 2001 From: 1computer1 Date: Sat, 1 Jun 2019 01:04:15 -0400 Subject: [PATCH] Fix special characters interferng in scripts --- docker/apl/run.sh | 2 +- docker/bash/run.sh | 2 +- docker/brainfuck/run.sh | 2 +- docker/c/run.sh | 2 +- docker/clojure/run.sh | 2 +- docker/cpp/run.sh | 2 +- docker/csharp/run.sh | 4 ++-- docker/elixir/run.sh | 2 +- docker/fsharp/run.sh | 2 +- docker/go/run.sh | 2 +- docker/haskell/run.sh | 2 +- docker/java/run.sh | 2 +- docker/javascript/run.sh | 4 ++-- docker/julia/run.sh | 4 ++-- docker/lua/run.sh | 2 +- docker/ocaml/run.sh | 2 +- docker/pascal/run.sh | 4 ++-- docker/perl/run.sh | 2 +- docker/php/run.sh | 2 +- docker/prolog/run.sh | 2 +- docker/python2/run.sh | 2 +- docker/python3/run.sh | 2 +- docker/racket/run.sh | 2 +- docker/ruby/run.sh | 2 +- docker/rust/run.sh | 2 +- 25 files changed, 29 insertions(+), 29 deletions(-) diff --git a/docker/apl/run.sh b/docker/apl/run.sh index 48a9362..581f1e7 100644 --- a/docker/apl/run.sh +++ b/docker/apl/run.sh @@ -1,6 +1,6 @@ mkdir "$CODEDIR" && cd "$CODEDIR" -echo "$1" > program.apl +printf %s "$1" > program.apl apl --OFF -s -f program.apl cd .. && rm -rf "$CODEDIR" diff --git a/docker/bash/run.sh b/docker/bash/run.sh index 04d1373..16bffa5 100644 --- a/docker/bash/run.sh +++ b/docker/bash/run.sh @@ -1,6 +1,6 @@ mkdir "$CODEDIR" && cd "$CODEDIR" -echo "$1" > program.sh +printf %s "$1" > program.sh bash program.sh cd .. && rm -rf "$CODEDIR" diff --git a/docker/brainfuck/run.sh b/docker/brainfuck/run.sh index ef1d0ee..46b195d 100644 --- a/docker/brainfuck/run.sh +++ b/docker/brainfuck/run.sh @@ -1 +1 @@ -bf "$1" +printf %s "$1" | bf diff --git a/docker/c/run.sh b/docker/c/run.sh index c637618..ae6b9d3 100644 --- a/docker/c/run.sh +++ b/docker/c/run.sh @@ -1,6 +1,6 @@ mkdir "$CODEDIR" && cd "$CODEDIR" -echo "$1" > program.c +printf %s "$1" > program.c gcc program.c -o program && ./program cd .. && rm -rf "$CODEDIR" diff --git a/docker/clojure/run.sh b/docker/clojure/run.sh index 8b31b02..4b2f897 100644 --- a/docker/clojure/run.sh +++ b/docker/clojure/run.sh @@ -1,6 +1,6 @@ mkdir "$CODEDIR" && cd "$CODEDIR" -echo "$1" > program.clj +printf %s "$1" > program.clj clojure program.clj cd .. && rm -rf "$CODEDIR" diff --git a/docker/cpp/run.sh b/docker/cpp/run.sh index d3c8b2a..b9236b9 100644 --- a/docker/cpp/run.sh +++ b/docker/cpp/run.sh @@ -1,6 +1,6 @@ mkdir "$CODEDIR" && cd "$CODEDIR" -echo "$1" > program.cpp +printf %s "$1" > program.cpp g++ program.cpp -o program && ./program cd .. && rm -rf "$CODEDIR" diff --git a/docker/csharp/run.sh b/docker/csharp/run.sh index 9028e92..d050032 100644 --- a/docker/csharp/run.sh +++ b/docker/csharp/run.sh @@ -1,9 +1,9 @@ if [ "$EVAL_EXPR" = "true" ]; then - csharp -e "$1" + printf %s "$1" | csharp -e else mkdir "$CODEDIR" && cd "$CODEDIR" - echo "$1" > program.cs + printf %s "$1" > program.cs csc program.cs >/dev/null && mono program.exe cd .. && rm -rf "$CODEDIR" diff --git a/docker/elixir/run.sh b/docker/elixir/run.sh index d0955a9..71a36e9 100644 --- a/docker/elixir/run.sh +++ b/docker/elixir/run.sh @@ -1,6 +1,6 @@ mkdir "$CODEDIR" && cd "$CODEDIR" -echo "$1" > program.exs +printf %s "$1" > program.exs elixir program.exs cd .. && rm -rf "$CODEDIR" diff --git a/docker/fsharp/run.sh b/docker/fsharp/run.sh index 2197e3f..79a7703 100644 --- a/docker/fsharp/run.sh +++ b/docker/fsharp/run.sh @@ -1,6 +1,6 @@ mkdir "$CODEDIR" && cd "$CODEDIR" -echo "$1" > program.fs +printf %s "$1" > program.fs fsharpc --optimize- program.fs >/dev/null && mono program.exe cd .. && rm -rf "$CODEDIR" diff --git a/docker/go/run.sh b/docker/go/run.sh index 7226cc5..642b42a 100644 --- a/docker/go/run.sh +++ b/docker/go/run.sh @@ -1,7 +1,7 @@ mkdir "$CODEDIR" && cd "$CODEDIR" export GOCACHE=/tmp/"$CODEDIR"/cache -echo "$1" > program.go +printf %s "$1" > program.go go run program.go cd .. && rm -rf "$CODEDIR" diff --git a/docker/haskell/run.sh b/docker/haskell/run.sh index ec7767a..62c45b4 100644 --- a/docker/haskell/run.sh +++ b/docker/haskell/run.sh @@ -3,7 +3,7 @@ if [ "$EVAL_EXPR" = "true" ]; then else mkdir "$CODEDIR" && cd "$CODEDIR" - echo "$1" > program.hs + printf %s "$1" > program.hs ghc -e main program.hs cd .. && rm -rf "$CODEDIR" diff --git a/docker/java/run.sh b/docker/java/run.sh index aba2315..565e6f4 100644 --- a/docker/java/run.sh +++ b/docker/java/run.sh @@ -1,6 +1,6 @@ mkdir "$CODEDIR" && cd "$CODEDIR" -echo "$1" > Main.java +printf %s "$1" > Main.java javac Main.java && java Main cd .. && rm -rf "$CODEDIR" diff --git a/docker/javascript/run.sh b/docker/javascript/run.sh index 5a13bec..d6a9e60 100644 --- a/docker/javascript/run.sh +++ b/docker/javascript/run.sh @@ -1,5 +1,5 @@ if [ "$EVAL_HARMONY" = "true" ]; then - node --harmony -p "$1" + printf %s "$1" | node --harmony -p else - node -p "$1" + printf %s "$1" | node -p fi diff --git a/docker/julia/run.sh b/docker/julia/run.sh index 5b134b1..c299f35 100644 --- a/docker/julia/run.sh +++ b/docker/julia/run.sh @@ -1,5 +1,5 @@ if [ "$EVAL_EXPR" = "true" ]; then - julia -E "$1" + printf %s "$1" | julia -E else - julia -e "$1" + printf %s "$1" | julia -e fi diff --git a/docker/lua/run.sh b/docker/lua/run.sh index 1d0a47b..6ac81b0 100644 --- a/docker/lua/run.sh +++ b/docker/lua/run.sh @@ -1,6 +1,6 @@ mkdir "$CODEDIR" && cd "$CODEDIR" -echo "$1" > program.lua +printf %s "$1" > program.lua lua5.3 program.lua cd .. && rm -rf "$CODEDIR" diff --git a/docker/ocaml/run.sh b/docker/ocaml/run.sh index be3a813..caccd04 100644 --- a/docker/ocaml/run.sh +++ b/docker/ocaml/run.sh @@ -1,6 +1,6 @@ mkdir "$CODEDIR" && cd "$CODEDIR" -echo "$1" > program.ml +printf %s "$1" > program.ml ocamlopt -cclib --static -o program program.ml && ./program cd .. && rm -rf "$CODEDIR" diff --git a/docker/pascal/run.sh b/docker/pascal/run.sh index 0e5965c..2d23489 100644 --- a/docker/pascal/run.sh +++ b/docker/pascal/run.sh @@ -1,6 +1,6 @@ mkdir "$CODEDIR" && cd "$CODEDIR" -echo "$1" > program.pas +printf %s "$1" > program.pas # fpc does not use stderr, ld however does, capture both res="$(fpc program.pas 2>&1)" @@ -8,7 +8,7 @@ res="$(fpc program.pas 2>&1)" if [ $? -eq 0 ]; then ./program else - echo "$res" + printf %s "$res" exit 1 fi diff --git a/docker/perl/run.sh b/docker/perl/run.sh index a620ee0..7778c41 100644 --- a/docker/perl/run.sh +++ b/docker/perl/run.sh @@ -1,6 +1,6 @@ mkdir "$CODEDIR" && cd "$CODEDIR" -echo "$1" > program.pl +printf %s "$1" > program.pl perl program.pl cd .. && rm -rf "$CODEDIR" diff --git a/docker/php/run.sh b/docker/php/run.sh index 0e00fd1..082f83b 100644 --- a/docker/php/run.sh +++ b/docker/php/run.sh @@ -1 +1 @@ -php -r "$1" +printf %s "$1" | php -r diff --git a/docker/prolog/run.sh b/docker/prolog/run.sh index 9db671e..5a37620 100644 --- a/docker/prolog/run.sh +++ b/docker/prolog/run.sh @@ -1,6 +1,6 @@ mkdir "$CODEDIR" && cd "$CODEDIR" -echo "$1" > program.pl +printf %s "$1" > program.pl swipl --quiet program.pl cd .. && rm -rf "$CODEDIR" diff --git a/docker/python2/run.sh b/docker/python2/run.sh index a45fd07..7496968 100644 --- a/docker/python2/run.sh +++ b/docker/python2/run.sh @@ -1,6 +1,6 @@ mkdir "$CODEDIR" && cd "$CODEDIR" -echo "$1" > program.py +printf %s "$1" > program.py python program.py cd .. && rm -rf "$CODEDIR" diff --git a/docker/python3/run.sh b/docker/python3/run.sh index a45fd07..7496968 100644 --- a/docker/python3/run.sh +++ b/docker/python3/run.sh @@ -1,6 +1,6 @@ mkdir "$CODEDIR" && cd "$CODEDIR" -echo "$1" > program.py +printf %s "$1" > program.py python program.py cd .. && rm -rf "$CODEDIR" diff --git a/docker/racket/run.sh b/docker/racket/run.sh index 9f394b4..60dd11d 100644 --- a/docker/racket/run.sh +++ b/docker/racket/run.sh @@ -1,6 +1,6 @@ mkdir "$CODEDIR" && cd "$CODEDIR" -echo "$1" > program.rkt +printf %s "$1" > program.rkt racket program.rkt cd .. && rm -rf "$CODEDIR" diff --git a/docker/ruby/run.sh b/docker/ruby/run.sh index bf8cbcd..3146029 100644 --- a/docker/ruby/run.sh +++ b/docker/ruby/run.sh @@ -1,6 +1,6 @@ mkdir "$CODEDIR" && cd "$CODEDIR" -echo "$1" > program.rb +printf %s "$1" > program.rb ruby program.rb cd .. && rm -rf "$CODEDIR" diff --git a/docker/rust/run.sh b/docker/rust/run.sh index 15bce66..8890f12 100644 --- a/docker/rust/run.sh +++ b/docker/rust/run.sh @@ -1,6 +1,6 @@ mkdir "$CODEDIR" && cd "$CODEDIR" -echo "$1" > program.rs +printf %s "$1" > program.rs rustc -C opt-level=0 --color never program.rs && ./program cd .. && rm -rf "$CODEDIR"