From 80d0d8433fa48707f17cb6aed7f2a32ff5234510 Mon Sep 17 00:00:00 2001 From: coolneng Date: Tue, 14 Feb 2023 15:46:23 +0100 Subject: [PATCH] Replace spaces with underline in subject script --- scripts/.local/share/scripts/subject | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/.local/share/scripts/subject b/scripts/.local/share/scripts/subject index cfdd97c..8a8368e 100755 --- a/scripts/.local/share/scripts/subject +++ b/scripts/.local/share/scripts/subject @@ -1,6 +1,5 @@ #!/bin/sh - if [ $# -lt 2 ]; then echo "Usage: subject " 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