Skip to main content
edited title
Link

It's possibile to usedelete some file with a $variable in to {} range af number in a name?

Post Closed as "Duplicate" by steeldriver bash
edited title
Link

It'spossibile It's possibile to use a $variable in to {} range?

Source Link

It'spossibile to use a $variable in to {} range?

I have many images captured from my webcam and their name are:

2021-03-29_06-00 2021-03-29_06-02 2021-03-29_06-04 2021-03-29_06-06 2021-03-29_07-00 2021-03-29_08-00 2021-03-29_09-00 etc.. 

I want to delete images shooted by night.

I found script to obtain sunrise (and sunset) times, now I have to filter my files and delete.

I start to try with ls command.

If I use:

ls *_{00..06}*.jpg 

the result is correct.

By if I insert a variable with the time of sunrise, encounter of problems.

SUNRISE="06" ls *_{00..$SUNRISE}*.jpg 

But the result are:

ls: cannot access '*_{00..06}.jpg': File or directory does not exist