For loop in bourne shell is not working

I have a loop with cases
I am working on Bourne shell

 for file in *.${Today}*.csv *.${Today}*.txt\
 do
  
 case ${file} in
    sun_detail)
        do something
     ;;
    sum)
       do something
    ;;
    mod)
      do something
    ;;
    *)
     do something
    ;;
 

I have a 50 files, three from them fall in three cases. I thought all others should get to common case *). But the first file got to that case and program exits without errors
Could you please help me with this?

Thanks for contribution

what OS and BASH are you using? the syntax varies a little from version to version.

sun_detail looks too specific, sun_detail.csv wouldn't match it for instance. Try *sun_detail*

I'm afraid that code snippet can't possibly run flawlessly:

  • the continuation ( \ ) between for ... and do needs to be dropped
  • done missing
  • esac missing

And, looking at the for construct, file will assume string values like ...csv or ...txt , which will never match sun_detail nor sum nor mod .

It is just an example

  
 case $file in
      sum_detasils*$Today*.csv
 

Could you please tell me if continue works in case statement?

---------- Post updated at 02:09 PM ---------- Previous update was at 02:07 PM ----------

 for file in *.${Today}*.csv *.${Today}*.txt
 do
case $file in
      sum_detasils*$Today*.csv)
             do something
             continue
        ;;
 esac
 done
 

Continue will work?

Please DON'T double post, seriously!

Please apply some care when posting - people can't tell if what you post is sloppy typing or copying or erroneous coding causing misbehaved programs.

I don't think continue is necessary -

Although from man bash , this should be valid for sh , too.

EDIT: Looking at your other thread, I see that your reasoning is a bit different. Another reason for a) no double posting, b) precise and detailed posting.