79663826

Date: 2025-06-12 16:04:02
Score: 0.5
Natty:
Report link

Why does digits end up empty

The glob expression [^0-9]* matches a non-digit characters [^0-9] and then matches any characters *. Just like echo [^0-9]* would match a file named abc-123.

How to get only the digits from a bash variable?

Remove the erroneous *.

digits=${both//[^0-9]/}
Reasons:
  • Low length (0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Starts with a question (0.5): Why do
  • High reputation (-2):
Posted by: KamilCuk