• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • Frits Walraven
  • Himai Minh

Bash Shell Script Questions

Ranch Hand
Posts: 226
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a file that has this filename: someText-2020-01-29.zip
The "2020" in the filename is the year. The "01" in the filename is the month and the "29" in the filename is the day.

How can I divide that filename into substrings using a bash shell script? I would like to extract the year, month, and day from the filename and set them equal to different variables.

I have several different files in a folder and some of those files are zip files. How can I write a bash shell script that can find out whether or not the files in my folder are zip files?
I'm a lumberjack and I'm okay, I sleep all night and work all day. Lumberjack ad:
Thread Boost feature
    Bookmark Topic Watch Topic
  • New Topic