I want to identify a string provided as an argument on command-line.I need to search only in just current directory and archives. my command is:
if grep -s "$1" * .*
then echo "found" else echo "not found"
But for example if i have one folder with the word "father" and another with "fathersa" and the string input is "father" my code output both folders.But if my input is "father "(father and space) the output should be only the first folder but my code display both folder.What should i do instead? Also is this command good enough to search through all folders and archives from my current directory? Edit: i`m using Ubuntu desktop (Ubuntu 12.04.4 LTS)
I also tried grep -w but my string is not exactly a fixed string, its actually a pattern so it isnt really what i wanted.If my input is "fa" my code should output all folders that contains the "fa" structures like "father" "fat" and so on but if my input would be "fa " with space my output should be only the folders with "fa" and just that