Suppose I wanted to create a script that would prompt for a file to be search for.Such that,echo What file are you searching for?read filenamefilepath=/test/dir1file=$filenamefor I in filedoecho $Ifind $filepath $IdoneThis seems to do a continual search for the filename specified. However, I get a find: file: No such file or directory
How to retrive a file from a prompt?
shell script
First of all, for I in file should probably be for I in $file; thedollar sign is needed when retrieving a variable's value.I would alter your script in the following ways:echo What file names are you searching for?read filesfilepath=/test/dir1for f in $filesdo    echo $f    find $filepath/$fdoneI removed the assignment to $file from $filenames, and assumed youmeant for the user to enter several whitespace-separated file names.Then I passed find a single path, constructed by separating thedirectory name and the file name with a single slash. If you meant tolook for a file named like this at an arbitrary depth, you may use find$filepath -name $f.