Store into a file the list of executable files of a system directory
How can i store into a file the list of executable files of a system directory?
My solution is: if test -f $1 and test -x $1 then echo $1 else echo "message" fi int a file e.g. test it runs correctly if i write test filename (only for 1 file), but i need a solution for all the files of a system directory. How can i recognize a system directory? i would appreciate any help |
When you post code, please do so using [code] tags. This inproves readability to preserving whitespace and using a fixed width font.
You can iterate over files like this: Code:
for thisfile in *; do Code:
for thisfile in *.txt; do |
you can also use find for that .. do 'man find' and take a look at the examples for 'find . -perm'
here's an example statement to list the executable files in a directory: Code:
find $dir -type f -perm /111 -maxdepth 1 |
Start reading your training material, do your own homework.
|
All times are GMT -5. The time now is 09:35 PM. |