Seriously. There doesn’t seem to be a way to do this. Every thing I ever try I just get bad substitution errors. The internet is full of people posting code that’s supposed to compare file extensions but none of it works. I’ve spent all morning trying everything I could find. I already gave up and I’m making this progeam in python instead but now I’m curious. How tf do you actually compare file extensions? If I have a folder fill of files and I want to run a command only on the png files, there seems to be no way to actually do this.

If someone posts “[[ $file == *.txt ]]” I’m going to fucking scream because THAT DOES NOT WORK. IT’S NOT VAILD BASH CODE.

    • OpenStars
      link
      fedilink
      English
      arrow-up
      7
      arrow-down
      1
      ·
      7 months ago

      I loved this comment:

      What is the extension of the file xyzzy.tar.gz? Or plugh.cfg.saved? In other words, are you treating extension as a simple technical issue or a semantic one?

      For an OS that does not have file “extensions”, it’s entirely up to the user to define whatever it is that they are trying to accomplish.