0

Noob linux here trying to understand wildcard matching when using find.

#find /opt/spark/jars -name data*
#find /opt/spark/jars -name datan*
/opt/spark/jars/datanucleus-rdbms-3.2.9.jar
/opt/spark/jars/datanucleus-core-3.2.10.jar
/opt/spark/jars/datanucleus-api-jdo-3.2.6.jar

How come data* doesn't match anything but datan* does?

jamiet
  • 101
  • 2
    Do you have a file in your current directory named data... that doesn't start with datan? – Jeff Schaller Jul 07 '20 at 13:02
  • Possibly helpful: https://unix.stackexchange.com/q/55430/315749 – fra-san Jul 07 '20 at 13:06
  • Or https://unix.stackexchange.com/questions/596606/expansion-doubt/596608#596608 – Paul_Pedant Jul 07 '20 at 13:08
  • 3
    Always quote your patterns, e.g. find /opt/spark/jars -name 'data*' for the reason that @JeffSchaller hints at. – icarus Jul 07 '20 at 13:11
  • 1
    Thanks. find /opt/spark/jars -name 'data*' did work. After a cursory glance at those shared articles I don't fully understand why so I'm going to go back and re-read them now. Thanks. – jamiet Jul 07 '20 at 14:30
  • 1
    "Do you have a file in your current directory named data... that doesn't start with datan?" yes, i did. I understand now :) thanks @JeffSchaller – jamiet Jul 07 '20 at 14:33

0 Answers0