Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • master
1 result

Target

Select target project
  • ricardo.dossanto1/tp_create_scripts
1 result
Select Git revision
  • master
1 result
Show changes
Commits on Source (2)
File moved
#!/bin/bash
shopt -s -o nounset
declare EXAM_NAME
declare DIRECTORY=""
declare NBR_EXO=1
declare LOOP_START=1
if test $# -lt 2; then
echo "Usage: $0 EXAM_NAME nbrExercices"
exit -1
fi
EXAM_NAME=$1
if ! [[ "$2" =~ ^[0-9]+$ ]]
then
echo "$2 is not a number (integer)"
exit -5
fi
NBR_EXO=$2
cd $(pwd)
if [[ "$EXAM_NAME" =~ ( |\') ]]; then
echo "EXAM_NAME should not contain spaces"
exit -2
fi
if test -d "$EXAM_NAME"; then
echo "DIRECTORY already exists, please choose another name"
exit -4
fi
mkdir $EXAM_NAME
if test ! -d "$EXAM_NAME"; then
echo "mkdir creation failed, aborting..."
exit -3
fi
cd $EXAM_NAME
# git init
touch ".gitignore"
echo -e "### C ### \n*.o\n*.exe\n*.out\n*.app" > .gitignore
for (( k=$LOOP_START; k<=$NBR_EXO; k++ ))
do
if test -d "exo${k}"; then
echo "One of the exo directory already exists, aborting"
exit -4
fi
mkdir "exo${k}"
cd "exo${k}"
touch "Makefile"
echo -e "#the compiler\nCC:=gcc\nCFLAGS:=-g -Wall -Wextra -fsanitize=address -fsanitize=leak -std=gnu11 \n#linker flags\nLDFLAGS:=-lm -lSDL2 -fsanitize=address\n\nFNAME:=exo${k}\n\nexo${k}: exo${k}.o\n\t\$(CC) -o \$@ \$^ \$(LDFLAGS)\n\t./exo${k}\nclean:\n\t@rm -f *.o exo${k}" > Makefile
# exit 0
touch "exo${k}.c"
echo -e "int main(void){\n}" > "exo${k}.c"
cd ..
done
echo $(git remote add origin ssh://git@ssh.hesge.ch:10572/ricardo.dossanto1/${EXAM_NAME})
declare BRANCH_NAME=$(git config init.defaultBranch)
echo $BRANCH_NAME
echo $(git add .)
echo $(git commit -m "Auto commit generation via script")
echo $(git push -u origin ${BRANCH_NAME})
exit 0
#!/bin/bash
shopt -s -o nounset
declare start=0
declare end=5
for (( k=$start; k<=$end; k++ ))
do
echo $k
done
......@@ -3,7 +3,7 @@
shopt -s -o nounset
declare TP_NAME
declare DIRECTORY=""
declare DIRECTORY="/home/rickyy/Desktop"
if test $# -lt 1; then
echo "Usage: $0 TP_NAME"
......@@ -49,9 +49,11 @@ echo -e "#ifndef _${TP_NAME^^}_H_\n#define _${TP_NAME^^}_H_\n#include <stdio.h>\
pwd
echo $(git remote add origin ssh://git@ssh.hesge.ch:10572/ricardo.dossanto1/${TP_NAME})
declare BRANCH_NAME=$(git config init.defaultBranch)
echo $BRANCH_NAME
echo $(git add .)
echo $(git commit -m "Auto commit generation via script")
echo $(git push -u origin master)
echo $(git push -u origin ${BRANCH_NAME})
#cd "/home/ricky/Desktop/"
#rm -r $TP_NAME
......