I have this shell
script but I don't know why it doesn't work after passing parameters to it...
Here it is
#!/bin/bash
# Check the argument type and change the directory depending on it.
# Open with code
create() {
directory="E:/husseinabbas/programming/Code"
use_directory=""
project_name="$1"
project_type="$2"
project_mode="$3" || "new"
repository_name="$4" || "$project_name"
repository_type="$5" || false
if [[ "$project_type" == "html" ]]
then
use_directory="${directory}/html_css/$project_name"
elif [[ "$project_type" == "node" ]]
then
use_directory="{$directory}/node-projects/$project_name"
elif [[ "$project_type" == "php" ]]
then
use_directory="F:/XAMPP/htdocs/$project_name"
elif [[ "$project_type" == "python" ]]
then
use_directory="{$directory}/python-projects/$project_name"
elif [[ "$project_type" == "flutter" ]]
then
use_directory="{$directory}/android/$project_name"
elif [[ "$project_type" == "test" ]]
then
use_directory="C:/Users/H.Abbas/Desktop/$project_name"
else
return
fi
# Activate the venv
cd "E:/husseinabbas/programming/Code/python-projects/day_automator"
source venv/Scripts/activate
python day_automator.py "$project_name" "$project_type" "$project_mode" "$repository_name" "$repository_type"
cd "$use_directory" || return
echo "# $project_name" >> README.md
git init
git add README.md
git commit -m "init"
git branch -M main
git remote add origin https://github.com/husseinYY/$repository_name.git
git push -u origin main
code .
}
"$@"
And I'm using this command to run it;
sh .\create.sh my_day python all my_day false
And it gives me this:-
.\create.sh: line 52: my_day: command not found
I have read other answers to this question but they weren't helpful
This paragraph is just here because Stackoverflow robot wants more details hehe