11-28-2010
Counting the number of readable, writable, and executable items in a directory
Hello, I'm writing a script in sh in which the first command line argument is a directory. from that, i'm suppose to count the number of readable, writable, and executable items in the directory. I know using $1 represents the directory, and ls would display all the items in the directory, and that ls | wc -l would count the number of items. I'm uncertain as to how to filter ls so that only the readable/writable/executable files are shown and counted, and since I don't know if i'm the user, group, or other I cant check the permissions.
could someone show me how to do this? Thanks
9 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Some simple questions from a simple man.
If i wanted to count the number of files contained within a directory, say /tmp would ls -l /tmp ¦ wc -l suffice and will it be accurate?
second one: How would i check the number of files with a certain string in the filename, in the same directory.
... (2 Replies)
Discussion started by: iamalex
2 Replies
2. UNIX for Dummies Questions & Answers
This should be so simple.. I have folder with about 27 subfolders in it, each folder has a number of fonts in it.. how do I get the total number of fonts for all subfolders? (2 Replies)
Discussion started by: glev2005
2 Replies
3. Shell Programming and Scripting
Hi All,
To start with, I have been reading this site for years, Unfortunately I do not consider myself versed well enough with scripts to provide useful help to others. The Blind cannot lead the Blind!
Many of you have provided me with brain food and solutions over the years without even... (4 Replies)
Discussion started by: Festus Hagen
4 Replies
4. Programming
Hi,
Can anyone tell me how to find out how many bits a c executable was compiled in?
I am trying to do some investigation of running 32bit programs in 64bit systems. (1 Reply)
Discussion started by: Leion
1 Replies
5. UNIX for Dummies Questions & Answers
Help Needed !
Can we count number of folders of specific date in a directory, even if directory has folders of different dates.
Please reply as soon as possible. (1 Reply)
Discussion started by: vishal_215
1 Replies
6. Shell Programming and Scripting
This is my first ever post... please help! :o
I have two columns....here is part of the file...
12, 46798
6692, 46799
5710, ... (3 Replies)
Discussion started by: pelhabuan
3 Replies
7. Shell Programming and Scripting
I am trying to display the output of ls and also print the number of characters in EVERY file name. This is what I have so far:
#!/bin/sh
for x in `ls`; do
echo The number of characters in x | wc -m
done
Any help appreciated (1 Reply)
Discussion started by: LinuxNubBrah
1 Replies
8. Shell Programming and Scripting
So I have a loop that stated if a directory exists or not. If it does it prints the number of files within that directory. I use this code...
result=`(ls -l . | egrep -c '^-')`
However, no matter which directory I input, it outputs the number "2"
What is wrong here? (4 Replies)
Discussion started by: itech4814
4 Replies
9. What is on Your Mind?
In the past few days have I have done a lot of code cleanup work in various categories, including faster page loading and bug fixes:
Move countless inline style directives to external CSS stylesheets for key pages (faster page loading)
Fixed bug in member panel going between desktop and... (6 Replies)
Discussion started by: Neo
6 Replies
LEARN ABOUT DEBIAN
wicd-wired-settings.conf
WICD-WIRED-SETTINGS.CONF(5) File Formats Manual WICD-WIRED-SETTINGS.CONF(5)
NAME
wicd-wired-settings.conf - controls Wicd's wired network settings
DESCRIPTION
This file contains configuration information for wired interfaces in Wicd.
This file is located at /etc/wicd/wired-settings.conf
SETTINGS
default = <0|1>
This option decides whether to use this profile as the default. 0 = do not use this profile as default.
1 = use this profile as default.
beforescript = <None|arbitrary_script>
This defines a script to run before Wicd brings up the connection. The script should be a Bourne-compatible script and should be
executable.
IMPORTANT - scripts should ONLY be writable by root and located in a directory that is only writable by root.
afterscript = <None|arbitrary_script>
This defines a script to run after Wicd brings up the connection. The script should be a Bourne-compatible script and should be
executable.
IMPORTANT - scripts should ONLY be writable by root and located in a directory that is only writable by root.
predisconnectscript = <None|arbitrary_script>
This defines a script to run before Wicd disconnects the interface. The script should be a Bourne-compatible script and should be
executable.
postdisconnectscript = <None|arbitrary_script>
This defines a script to run after Wicd disconnects the interface. The script should be a Bourne-compatible script and should be
executable.
IMPORTANT - scripts should ONLY be writable by root and located in a directory that is only writable by root.
ip = <None|ip_address>
Use this option if you have a static ip address for your system.
netmask = <None|networkmask>
This setting is only appropriate if a static ip address is configured above.
broadcast = <None|broadcast_address>
This setting is only appropriate if a static ip address is configured above.
gateway = <None|gateway_address>
This setting is only appropriate if a static ip address is configured above.
use_static_dns = <True|False>
True = use static DNS servers instead of accepting what the dhcp server supplies.
use_global_dns = <True|False>
True = use the global DNS servers provided in wicd-manager-settings.conf(5). This option is only appropriate if "use_static_dns =
True"
dns1 = <None|ip_address>
Static DNS address if "use_static_dns = True" and "use_global_dns = False"
dns2 = <None|ip_address>
Static DNS address if "use_static_dns = True" and "use_global_dns = False"
dns3 = <None|ip_address>
Static DNS address if "use_static_dns = True" and "use_global_dns = False"
SEE ALSO
wicd(8), wicd-curses(8), wicd-manager-settings.conf(5), wicd-wireless-settings.conf(5).
wicd-1.7.2.4 WICD-WIRED-SETTINGS.CONF(5)