Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Easier still...' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Easier still...
Authored by: sharumpe on Mar 11, '01 04:14:45PM

This is kinda over-engineered for this particular example.

Try this instead:

chmod -R 755 *

This will give the owner rwx and the group and world r-x in on every file in the current directory and all subdirectories.

If the command you are using doesn't support the -R (for recursive) flag (many don't). then you can also do this:

cat `find . -type f`

Backticks (in tcsh, at least) execute the enclosed command. This example will run the find command, which returns the names of all 'normal' files in the current subdirectory and all it's children, and gives those filenames to cat, which will print the contents out (this is a silly example, but does the trick).

In any case, for chmod (and chown) the -R command will do the trick with less keystrokes.

Mr. Sharumpe



[ Reply to This | # ]
Usless use of cat . . .
Authored by: Anonymous on Mar 13, '01 07:04:59PM

As you become more experienced with UNIX you
will (perhaps) hear of 'the useless use of cat' argument.
The previous was a good example of it. Why not just:

% chmod -R 777 .
# chmod EVERYTHING, with recursion, to 777 from the current location, then
% find . -type f -exec chmod 666 {} \\;
# find all FILES chmod to 666 [ the '\\;' is required, read about it with 'man find']
# foreach file find puts the filename where the '{}' curly braces are and executes the
# command. Very elegant and powerful. BTW: it took 4 slashes in this editor to print a
# single backslash like this '\'



[ Reply to This | # ]