1

Problem 1: I'm trying to create subfolders for the projects that started at certain year. To do that,I tried to use the spread operator but the result was simply {<start_year>..<end_year>}. I tried with the comma operator,and it worked. Maybe i'm missing something.

    └── projects
        ├── 2018
        ├── 2019
        ├── 2020
        └── 2021

## The code

declare -i START_DATE=$(date --date="3 years ago" +'%Y')  
declare -i END_DATE=$(date +'%Y')

mkdir -p projects/{$START_DATE..$END_DATE} 

________________________________________
result:
    
         projects
         └── {2018..2021}

Problem 2: If I try to use a variable SUB_PROJECTS={$START_DATE,$END_DATE} to be readable and easier to change values, the bash command cannot distiguish the symbols, only assume as a whole string. How I can solve this?

SUB_PROJECTS={$START_DATE,$END_DATE}
mkdir -p projects/$SUB_PROJECTS
________________________________________

result:
    
         projects
         └── `{2018,2021}`


bmalbusca
  • 353
  • 1
  • 4
  • 15

0 Answers0