BASH find -name (read variable)

bash, find, variables

Solution

Most probably

read MYNAME
find -name "$MYNAME"

is the version you are looking for. Without the double quotes `"` the shell will expand `*` in your `*sh` example prior to running `find` that's why your first attempt didn't work

Problem

I'm new to bash and have encountered a problem i can't solve. The issue is i need to use find -name with a name defined as a variable. Part of the script: ``` read MYNAME find -name $MYNAME ``` But when i run the script, type in '*sh' for read, there are 0 results. However, if i type directly in the terminal: ``` find -name '*sh' ``` it's working fine. I also tried ``` read MYNAME find -name \'$MYNAME\' ``` with typing *sh for read and no success. Can anyone help me out?

Original source