I'm trying to understand how to use curly braces and quotes properly in bash. I'm wondering why the third example of an ls command doesn't work.
#!/bin/bash -vx
# File name prefix.
File_name_prefix='this_is_a_file_name_prefix'
# Let's do this in the /tmp directory.
cd /tmp
# Let's make three empty files.
touch ${File_name_prefix}_1.txt
touch ${File_name_prefix}_2.txt
touch ${File_name_prefix}_3.txt
# Let's list the three files.
# This works.
ls "$File_name_prefix"*
# This works.
ls ${File_name_prefix}*
# This does not work.
ls "${File_name_prefix}*"
# This fails.
find ./ -type f -name '${File_name_prefix}*'
# This fails spectacularly.
find ./ -type f -name ${File_name_prefix}*
# But this works.
find ./ -type f -name "${File_name_prefix}*"
echo "Why?"
# Clean up.
rm ${File_name_prefix}*
exit