Sponsored Content
Top Forums Shell Programming and Scripting Script to check files ownership Post 302885087 by Corona688 on Thursday 23rd of January 2014 11:35:53 AM
Old 01-23-2014
That is a useless use of ls *, ls does not need it. If the number of files is large enough, * will break down when plain ls would be fine, too.

I started putting awk's output into a loop then realized the loop itself kind of makes awk unnecessary.

Code:
ls -l /dtr/tools/bin/ | while read PERMISSION OWNER GROUP SIZE MON DAY YEAR FILENAME
do
        echo "filename is $FILENAME"
        # Rest of code here
done

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How do I change ownership of a directory and all of it's files.

How do I change ownership of a directory and all of it's files without changing permissions? (1 Reply)
Discussion started by: mborin
1 Replies

2. UNIX for Dummies Questions & Answers

ownership of files

Hi, While changing ownerships from the root on a server i'm managing, i typed chown -R username:users * and it changed all ownership to username. Can someone tell me if there is someway I can set things back the way they were before? I can't even su username from the root. Am I going to just... (4 Replies)
Discussion started by: szhu
4 Replies

3. Linux

files ownership/permission problem

all the files and directories in my system are owned by root only.i try to(from root loggin) change the permission on the file but not permitted.can any one help to fix my problem .also while installing any software always error occur like no makefile available (1 Reply)
Discussion started by: jop
1 Replies

4. UNIX for Dummies Questions & Answers

100% ownership to files

ok. this is a bit complicated. i have a manager here who wants me to give another user access to all the files he owns. he wants this other user to have the same rights has he does. the problem has been that whenever the manager creates a new file the permissions on the files created... (3 Replies)
Discussion started by: Terrible
3 Replies

5. UNIX for Advanced & Expert Users

command to copy files with original ownership

Hi, I need a command that to copy files from others and to keep files' ownership. Example: I copy file.txt from users "abc" to my local, and file.txt is own by user "abc" in local. Thanks in advance! (3 Replies)
Discussion started by: need_help
3 Replies

6. UNIX for Dummies Questions & Answers

copy all files and folders and cjange or remove ownership

So tried: cp -r -p test1/ user@machine:///srv/www/vhosts/domain.co.uk/httpdocs/backup/ but this didn't work either :( Anyone able to help with this? Many thanks Mr M (3 Replies)
Discussion started by: misterm
3 Replies

7. UNIX for Dummies Questions & Answers

Getting rid of files with no ownership

I am in the process of learning how to do system administration (just on my own Linux machine) and have been working with the find command. One of the things I tried was find / -nouser -o -nogroup I redirected the output of my find query into a text file, and when I did a wc -l on it, it... (1 Reply)
Discussion started by: kermit
1 Replies

8. UNIX for Dummies Questions & Answers

Ownership of files in bin directory

When I checked to see who or what owns the files in my bin directory I noticed that some were owned by root while many others were owned by bin. Should I be concerned that there are files in this directory owned by bin or is bin the same as root as it pertains to limiting access to the files in... (3 Replies)
Discussion started by: j490428
3 Replies

9. UNIX for Advanced & Expert Users

SuSE-11 Ownership of files having root got changed

Hi Experts, I have create a new user with uid and gid as 0 in SuSE-11 Server. After that all the files having root owner ship are showing as new user name as owner. If I login as root, and type 'id' command, it also shows the new user. Sample output from my server. host:~ # id uid=0(test)... (4 Replies)
Discussion started by: vipinable
4 Replies

10. Shell Programming and Scripting

need a shell script to extract the files from source file and check whether those files existonserve

Hi, I am new to shell scripting.Please help me on this.I am using solaris 10 OS and shell i am using is # echo $0 -sh My requirement is i have source file say makefile.I need to extract files with extensions (.c |.cxx |.h |.hxx |.sc) from the makefile.after doing so i need to check whether... (13 Replies)
Discussion started by: muraliinfy04
13 Replies
INNCHECK(8)						      System Manager's Manual						       INNCHECK(8)

NAME
inncheck - check inn configuration and database files. SYNOPSIS
inncheck [ -a ] [ -v ] [ -pedantic ] [ -f ] [ -perm ] [ -noperm ] [ file=value | file ] DESCRIPTION
Inncheck examines various configuration files and databases and verifies things about them. Things verified depend on the file being checked, but generally are things like permissions, ownership, syntax errors in config files, etc. Inncheck does not make changes to any files -- it just reports what it thinks may be wrong, and it is up to the operator to fix the prob- lem. The set of files checked may be restricted by using file or file=value arguments. For example, putting incoming.conf causes only the incom- ing.conf file to be checked. Using incoming.conf=/tmp/incoming.conf on the command line will cause inncheck to only verify the incom- ing.conf file, and it will perform the checks on the file /tmp/incoming.conf file instead of the default one. Valid values for file are: active control.ctl expire.ctl incoming.conf inn.conf moderators newsfeeds nntpsend.ctl passwd.nntp readers.conf OPTIONS
-a If any ``file'' value or ``file=value'' pairs (see below) are given, then normally only the files they refer to are checked. Use the ``-a'' flag to specify that all files should be checked regardless. In this case the form file=value will be the more useful. -v Use the ``-v'' option to get more verbose output. -pedantic Use the ``-pedantic'' option to get reports on things that are not necessarily wrong, but may indicate a bad configuration -- such as inn.conf missing a key. -f Use the ``-f'' flag to have inncheck print the appropriate chown/chgrp/chmod command necessary to fix a problem that it reports. Any other output lines will be prefixed with a ``#'' character to make the output be valid input for a shell. Note that the ``-perm'' flag must be used as well when using this flag. -perm Inncheck checks all files for permission problems. If the ``-perm'' flag is used, then only the files specified by the file or file=value command line arguments will be checked for problems other than permission problems. -noperm To avoid doing any checking of file permissions or ownership, use the ``-noperm'' option. EXAMPLES
To have inncheck check all files for syntax and permission problems simply: inncheck To have inncheck check all files for permission problems and to verify the syntax of the active and incoming.conf files do: inncheck -perm active incoming.conf To fix the permissions problems noted in the output of the above command, modify it as follow: inncheck -f -perm | sh To have inncheck check the test newsfeeds file in /var/tmp/newsfeeds.testing, do: inncheck newsfeeds=/var/tmp/newsfeeds.testing To have inncheck check all the files as it normally does, but to specify a different location for the newsfeeds file, so: inncheck -a newsfeeds=/var/tmp/newsfeeds.testing BUGS
If the ``-f'' and ``-perm'' options are used together, along with ``-a'' or some ``file'' or ``file=value'' arguments that refer to a file with a syntax problem, then the output will no longer be valid input for a shell. HISTORY
Written by Brendan Kehoe <brendan@cygnus.com> and Rich Salz <rsalz@uunet.uu.net> This is revision 8409, dated 2009-04-11. SEE ALSO
active(5), expire.ctl(5), history(5), incoming.conf(5), inn.conf(5), newsfeeds(5) INNCHECK(8)
All times are GMT -4. The time now is 01:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy