Replace spaces with underline in subject script

This commit is contained in:
coolneng 2023-02-14 15:46:23 +01:00
parent 4779337530
commit 80d0d8433f
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
1 changed files with 5 additions and 5 deletions

View File

@ -1,6 +1,5 @@
#!/bin/sh
if [ $# -lt 2 ]; then
echo "Usage: subject <subject name> <subject type>"
echo "subject type 0: programming"
@ -11,10 +10,11 @@ fi
name=$1
type=$2
mkdir -p "$name"/Labs
mkdir -p "$name"/Exercises
touch "$name"/.project
formatted_name=$(echo "$name" | tr -s ' ' '_')
mkdir -p "$formatted_name"/Labs
mkdir -p "$formatted_name"/Exercises
touch "$formatted_name"/.project
if [ "$type" -eq 0 ]; then
mkdir -p "$name"/Code
mkdir -p "$formatted_name"/Code
fi