From c5ccc0c7fb5b09adfd1372dbcecbda0615513ac1 Mon Sep 17 00:00:00 2001 From: Shubham Chaudhary Date: Mon, 24 Jun 2013 04:21:34 +0530 Subject: [PATCH] Really small script --- c.sh | 9 +++++++++ cpp.sh | 12 ++++++++++++ 2 files changed, 21 insertions(+) create mode 100755 c.sh create mode 100755 cpp.sh diff --git a/c.sh b/c.sh new file mode 100755 index 0000000..8e59a36 --- /dev/null +++ b/c.sh @@ -0,0 +1,9 @@ +##this script compiles .c files +nameLen=${#1} +filename=${1:0:nameLen-2} #striping last 2 char i.e. '.c' +echo " * * * gcc: Compiling $filename * * *" + +gcc -g -O2 -Wall -Wextra -Isrc -rdynamic $1 -o $filename.out + +echo " * * * Done * * * " +echo "Now Do: ./$filename.out" diff --git a/cpp.sh b/cpp.sh new file mode 100755 index 0000000..f3ff79c --- /dev/null +++ b/cpp.sh @@ -0,0 +1,12 @@ +##this script compiles .cpp files +nameLen=${#1} +filename=${1:0:nameLen-4} #striping last 4 char i.e. '.cpp' +echo " * * * g++: Compiling $filename * * *" + +g++ -g -O2 -Wall -Wextra -Isrc -rdynamic $1 -o $filename.out + +if [-f $filename.test]; then + cat $filename.test | ./$filename.out +fi +echo " * * * Done * * * " +echo "Now Do: ./$filename.out"