find command
hi all
I want to find out all .sh files in a directory and store result in a file. I am doing it like this "find "$dir" *.sh | grep "$dir" | grep .sh >> /root/shFiles" but result includes those file which contains "sh" in their file name. But i want only .sh files. How can I solve this. Thanks MKSC |
find "$dir" -name "*.sh" > /root/shFiles
should be what you are looking for |
Quote:
|
Quote:
This one will work better. Note the quotes around *.sh If you put "*.sh", bash will replace with *.sh in current directory and find may try to find myscript.sh and only myscript.sh. With simple quotes, find correctly try to find anything that terminates whith sh. |
All times are GMT -5. The time now is 02:44 AM. |