0

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
  • Your problem lies with the order of expansions in `bash`, brace expansion is done BEFORE the variable is evaluated. Maybe [this answer](https://unix.stackexchange.com/a/164733/123460) will help? – FelixJN Mar 29 '21 at 21:37
  • [How can I use $variable in a shell brace expansion of a sequence?](https://unix.stackexchange.com/q/7738/170373) – ilkkachu Mar 29 '21 at 21:40

0 Answers0