Web Hosting Talk







View Full Version : writing a bash script - please help


SysTeam
01-20-2009, 07:51 PM
Hello!
I am writing a bash script, and need to view all files in directory except .cache files and files that do not have any extension.
How to do this?
Thank you!

Adam-AEC
01-21-2009, 03:18 PM
This will get you started. I'll let you figure out the rest.
find . -maxdepth 1 -type f -name '[!.]*.*' -print

SysTeam
01-21-2009, 03:27 PM
Thank you, but I need to except .cache files:
root@server [/var/cpanel/userdata/username]# find . -maxdepth 1 -type f -name '[!.]*.*' -print
./site.com
./site.com.cache
./main.cache
Another command: ls *.*, but I need to except *.cache.

Adam-AEC
01-21-2009, 03:36 PM
I left it for you to figure out, since the only way to learn is to do something yourself.
But, since that's not the case and you want me to write it for you.
find . -maxdepth 1 -type f -name '[!.]*.*' -print | grep -v .cache