Code:
echo "Enter the file name"
read fname
find / -name `$fname` -print
Issue: getting error message ‘Command not found’
Enter the file to searched \n
myfile
Check01.sh: line 4: myfile: command not found
I want to search the file name entered by the user at the command prompt.
What is the correct syntax or is there any other way to implement this?
You are using backticks (‘`’), rather than quotation marks.
Your shell is trying to execute the input (
myfile) and use this as the input to thefindcommand.Try this instead: