Sponsored Content
Top Forums Shell Programming and Scripting Counting the number of readable, writable, and executable items in a directory Post 302475437 by jim mcnamara on Sunday 28th of November 2010 08:26:21 PM
Old 11-28-2010
This sounds like homework. We have a homework forum.

Anyway, please post homework there. The answer I'm giving you will not be believed by your prof - i.e., she will think you got it off the internet, which is true.

Code:
ls -l $1 | awk ' $1 ~ /r/ {r++} $1 ~ /w/ {w++} $1 ~ /x/ {x++} 0 
                    END { printf( "read %d write %d execute %d \n", r,w,x) }'

 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Counting number of files in a directory

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

Number of items in a directory

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

Counting items in variables, How come this works, However

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

Finding the number of bits a executable was compiled

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

Counting number of folders in a Directory

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

awk, help me - counting items and listing them

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

counting the number of characters in the filename of all files in a directory?

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

Counting the number of files within a directory input by the user

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?

Number of Small Forum Code Changes (TODO List Items)

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
Gtk2::RecentChooser(3pm)				User Contributed Perl Documentation				  Gtk2::RecentChooser(3pm)

NAME
Gtk2::RecentChooser - wrapper for GtkRecentChooser HIERARCHY
Glib::Interface +----Gtk2::RecentChooser METHODS
$chooser->add_filter ($filter) o $filter (Gtk2::RecentFilter) recentinfo = $chooser->get_current_item string = $chooser->get_current_uri $chooser->set_current_uri ($uri) o $uri (string) May croak with a Glib::Error in $@ on failure. recentfilter = $chooser->get_filter $chooser->set_filter ($filter) o $filter (Gtk2::RecentFilter) (list) = $chooser->get_items integer = $chooser->get_limit $chooser->set_limit ($limit) o $limit (integer) (filters) = $chooser->list_filters boolean = $chooser->get_local_only $chooser->set_local_only ($local_only) o $local_only (boolean) $chooser->remove_filter ($filter) o $filter (Gtk2::RecentFilter) $chooser->select_all boolean = $chooser->get_select_multiple $chooser->set_select_multiple ($select_multiple) o $select_multiple (boolean) $chooser->select_uri ($uri) o $uri (string) May croak with a Glib::Error in $@ on failure. boolean = $chooser->get_show_icons $chooser->set_show_icons ($show_icons) o $show_icons (boolean) boolean = $chooser->get_show_not_found $chooser->set_show_not_found ($show_not_found) o $show_not_found (boolean) boolean = $chooser->get_show_private $chooser->set_show_private ($show_private) o $show_private (boolean) boolean = $chooser->get_show_tips $chooser->set_show_tips ($show_tips) o $show_tips (boolean) $chooser->set_sort_func ($sort_func, $sort_data=undef) o $sort_func (scalar) o $sort_data (scalar) recentsorttype = $chooser->get_sort_type $chooser->set_sort_type ($sort_type) o $sort_type (Gtk2::RecentSortType) $chooser->unselect_all $chooser->unselect_uri ($uri) o $uri (string) (list) = $chooser->get_uris PROPERTIES
'filter' (Gtk2::RecentFilter : default undef : readable / writable / private) The current filter for selecting which resources are displayed 'limit' (integer : default -1 : readable / writable / private) The maximum number of items to be displayed 'local-only' (boolean : default true : readable / writable / private) Whether the selected resource(s) should be limited to local file: URIs 'recent-manager' (Gtk2::RecentManager : default undef : writable / construct-only / private) The RecentManager object to use 'select-multiple' (boolean : default false : readable / writable / private) Whether to allow multiple items to be selected 'show-icons' (boolean : default true : readable / writable / private) Whether there should be an icon near the item 'show-not-found' (boolean : default true : readable / writable / private) Whether the items pointing to unavailable resources should be displayed 'show-private' (boolean : default false : readable / writable / private) Whether the private items should be displayed 'show-tips' (boolean : default false : readable / writable / private) Whether there should be a tooltip on the item 'sort-type' (Gtk2::RecentSortType : default "none" : readable / writable / private) The sorting order of the items displayed SIGNALS
item-activated (Gtk2::RecentChooser) selection-changed (Gtk2::RecentChooser) ENUMS AND FLAGS
enum Gtk2::RecentSortType o 'none' / 'GTK_RECENT_SORT_NONE' o 'mru' / 'GTK_RECENT_SORT_MRU' o 'lru' / 'GTK_RECENT_SORT_LRU' o 'custom' / 'GTK_RECENT_SORT_CUSTOM' enum GtkRecentChooserError o 'not-found' / 'GTK_RECENT_CHOOSER_ERROR_NOT_FOUND' o 'invalid-uri' / 'GTK_RECENT_CHOOSER_ERROR_INVALID_URI' SEE ALSO
Gtk2, Glib::Interface COPYRIGHT
Copyright (C) 2003-2011 by the gtk2-perl team. This software is licensed under the LGPL. See Gtk2 for a full notice. perl v5.14.2 2012-05-27 Gtk2::RecentChooser(3pm)
All times are GMT -4. The time now is 11:59 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy