I have a variable whose value I want to pass into a command. However the $ is producing unusual results. It appears to be acting like an * and searching all directories. My code is:
"Please enter the test type: "
read test
result="pass"
search_result=`find ./logs/$test_2017_01_logs*/* -type f -name func_log -exec egrep $result {} \;`
echo "$search_result"
I only want to search the directory suffix that was read in by the user, not all directories which is what my code is doing.
Is the issue due to the concatenation of the passed in value ($test) and the remainder of the folder name (_2017_01_logs*)?