Hello just a noob hobbyist here so this hopefully isn't too simple of a question.
I am trying to write a script that will let me generate the entire file structure for my media using only user inputs. I have everything working execept at line 20 where the 'mkdir Season{1..$user_input4} lives. I would like it to take the user input_4 and make 1 + that many directories but I feel I may be looking at this from the wrong perspective as it instead makes a subdirectory named Season{1..(prints the user input)}.
#!/bin/bash
file_created="Directory Created"
directory_number=0
echo "How many directories should be created?"
read user_input
while [ $directory_number -ne $user_input ]
do
echo "Enter Directory Name"
read user_input2
mkdir $user_input2
directory_number=$((directory_number + 1))
echo "Do you want to create Seasons? Y/N"
read user_input3
if [ $user_input3 == "Y" ]
then
echo "Enter number of seasons"
read user_input4
cd $user_input2/
mkdir Season{1..$user_input4}
cd ..
else
:
fi
done
If anyone has any ideas they would be greatly appreciated. Thanks!
bash
doesn't allow variable expansion inside brace expansion: see for example How can I use $variable in a shell brace expansion of a sequence? – steeldriver May 21 '19 at 21:31