Skip to content
Snippets Groups Projects
Commit 2b1fa2f2 authored by ricardo.dossanto1's avatar ricardo.dossanto1
Browse files

ta soeur Antoine

parents
No related branches found
No related tags found
No related merge requests found
#!/bin/bash
declare USER_INPUT="NULL"
PROMPT=">"
while [ $USER_INPUT == "NULL" ]; do
echo "Usage example: >/home/usr_name\/Desktop/"
read -p "${PROMPT}" USER_INPUT
echo -en "\033[1A\033[2K"
echo "Typed: $USER_INPUT"
done
sed -i "6s#.*#declare DIRECTORY=\"$USER_INPUT\"#" tp_create.sh
echo "Configuring done, please check if the directory you gave actually exists and is the correct one you wanna use before launching the script\n"
exit 0
#!/bin/bash
shopt -s -o nounset
declare TP_NAME
declare DIRECTORY=""
if test $# -lt 1; then
echo "Usage: $0 TP_NAME"
exit -1
fi
TP_NAME=$1
cd $DIRECTORY
if [[ "$TP_NAME" =~ ( |\') ]]; then
echo "TP_NAME should not contain spaces"
exit -2
fi
if test -d "$TP_NAME"; then
echo "DIRECTORY already exists, please choose another name"
exit -4
fi
mkdir $TP_NAME
if test ! -d "$TP_NAME"; then
echo "mkdir creation failed, aborting..."
exit -3
fi
cd "$TP_NAME"
git init
touch "Makefile"
echo -e "CFLAGS:=-g -Wall -Wextra -fsanitize=address -fsanitize=leak -std=gnu11 \n#linker flags\nLDFLAGS:=-lm -lSDL2 -fsanitize=address\n\nFNAME:=$TP_NAME\n\n${TP_NAME}: ${TP_NAME}.c ${TP_NAME}.h main.o\n \t \$(CC) -o \$@ \$^ \$(LDFLAGS)\n\t./$TP_NAME\nclean:\n\t@rm -f *.o $TP_NAME" > Makefile
touch "main.c"
echo -e "#include \"${TP_NAME}.h\"\n\nint main(void){\n}" > main.c
touch "${TP_NAME}.c"
touch "${TP_NAME}.h"
echo -e "#ifndef _${TP_NAME^^}_H_\n#define _${TP_NAME^^}_H_\n#include <stdio.h>\n#include <stdlib.h>\n#include <stdbool.h>\n\n#endif" > "${TP_NAME}.h"
pwd
echo $(git remote add origin ssh://git@ssh.hesge.ch:10572/ricardo.dossanto1/${TP_NAME})
echo $(git add .)
echo $(git commit -m "Auto commit generation via script")
echo $(git push -u origin master)
#cd "/home/ricky/Desktop/"
#rm -r $TP_NAME
exit 0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment