How to check, if a string is ending with a number?

I have makefile shared by multiple projects, which links shared libraries. The sources -- and the library-names -- are set by each project's own GNUmakefile.

When the library-name (${SO}) contains the version (libfoo.so.2) I need to to create a symlink:

 libfoo.so -> libfoo.so.2

What's the elegant way to remove the version-number in this example?

SO_LINK=$(???? ${SO})
...
ifneq(${SO_LINK},${SO})
      ln -sf ${SO} ${SO_LINK}
endif


Read more here: https://stackoverflow.com/questions/64951116/how-to-check-if-a-string-is-ending-with-a-number

Content Attribution

This content was originally published by Mikhail T. at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: