getting thousand of permissions


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting getting thousand of permissions
# 8  
Old 12-20-2007
Sir Ghost,
I thank you for your kindness. Are you a shell programmer? what is your job? Anyway, this is the output that i wanted.

/var/adm/cron/at.allow has the permission 0
/var/adm/cron/cron.allow has the permission 0
/usr/bin/uname has the permission 555
/usr/bin has the permission 755
/dev/mem has the permission 440


$ cat test
/var/adm/cron/at.allow
/var/adm/cron/cron.allow
/usr/bin/uname
/usr/bin
/dev/mem
# 9  
Old 12-20-2007
Code:
while read line 
do
    ls -l $line | awk '
    BEGIN{
    perm["rwx"]=7
    perm["rw-"]=6
    perm["r--"]=4
    perm["-wx"]=3
    perm["--x"]=1
    perm["r-x"]=5
    pern["-w-"]=2
    }
    {
    uperm = substr($1,2,3)
    gperm = substr($1,5,3)
    operm = substr($1,8,3) 
    printf "%s has permission: %s%s%s\n", $9,perm[uperm],perm[gperm],perm[operm]
    }
    '
done < test

# 10  
Old 12-20-2007
stil got no exact results..
this is the result of the said script Smilie

users has permission: 555
usrck has permission: 5
utftp has permission: 55
uucp has permission: 55
uudecode has permission: 555
uuencode has permission: 555
uulog has permission: 555
uuname has permission: 55
uupick has permission: 555
uupoll has permission: 555
uuq has permission: 55
uusend has permission: 555
uusnap has permission: 55
uustat has permission: 55
uuto has permission: 555
uux has permission: 55
vacation has permission: 555
val has permission: 555
vc has permission: 555
vedit has permission: 555
vgrind has permission: 755
vi has permission: 555
view has permission: 555
vmh has permission: 555
vmstat has permission: 55
vmstat64 has permission: 55
w has permission: 55
w64 has permission: 55
wait has permission: 555
wallevent has permission: 777
wc has permission: 555
what has permission: 555
whatis has permission: 555
whatnow has permission: 555
whereis has permission: 555
which has permission: 555
who has permission: 555
whoami has permission: 555
whois has permission: 555
whom has permission: 555
wlmmon has permission: 777
write has permission: 555
wsm has permission: 777
xargs has permission: 555
xget has permission: 555
xmodem has permission: 555
xmwlm has permission: 755
xsend has permission: 555
yacc has permission: 777
yes has permission: 555
ypcat has permission: 555
ypmatch has permission: 555
yppasswd has permission: 55
ypservers has permission: 555
ypwhich has permission: 555
zcat has permission: 555
zcmp has permission: 777
zgrep has permission: 777
zmore has permission: 777
znew has permission: 777
2005 has permission: 44
# 11  
Old 12-20-2007
i have left out perm["---"] , you can add it in to represent 0.
# 12  
Old 12-20-2007
sir this is the content of my file name test.

$ cat test
/var/adm/cron/at.allow
/var/adm/cron/cron.allow
/usr/bin/uname
/usr/bin
/dev/mem
/etc/hosts.equiv
/var/adm/sulog
/etc/security/failedlogin
/var/adm/wtmp
/etc/security/lastlog
$


this is the output that i wanted to achieve :

/var/adm/cron/at.allow has the permission 0
/var/adm/cron/cron.allow has the permission 0
/usr/bin/uname has the permission 555
/usr/bin has the permission 755
/dev/mem has the permission 440
/etc/hosts.equiv has the permission 644
/var/adm/sulog has the permission 600
/etc/security/failedlogin has the permission 0
/var/adm/wtmp has the permission 644
/etc/security/lastlog has the permission 0

$
# 13  
Old 12-20-2007
use the perl script then, if you still can't get the results.
# 14  
Old 12-20-2007
yeah i know..thanks, thanks for those who reply.
Login or Register to Ask a Question

Previous Thread | Next Thread

4 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Concatenate several thousand files in unix

Hello, I would like to concatenate several thousand files (~40,000) into 1. I cannot do it with cat *.extension - it gives me an error that there are too many arguments. Any suggestions? Thanks, Gussi (6 Replies)
Discussion started by: Gussifinknottle
6 Replies

2. Linux

Try thousand times could not resolve famous ORA-12514 error

It is related to Linux, Oracle 9.2.0. I am new to Oracle. I am trying to connect to Oracle database say A, but as I am running this command dbstart the error is “ORA-12514: TNS: listener could not resolve SERVICE_NAME given in connect descriptor” I have successfully started lsnrctl. Here... (3 Replies)
Discussion started by: yajneshilu
3 Replies

3. Shell Programming and Scripting

removing thousand of carriage returns using sed

I need to replace thousands of carriage returns/line breaks in a large xml file and with spaces. I hope to do so with a script, called, for example, "removeCRs." I would invoke this at the command line as ml5003$ sed -f /Users/ml5003/removeCRs oldFile > newFile The script, I presume, would... (4 Replies)
Discussion started by: ml5003
4 Replies

4. What is on Your Mind?

65 thousand dollar question

I was just a-wondering through some hardware and software sites, and in one of them, I was scrolling down a UNIX os page when I noticed that the prices for these OS's were climbing alarmingly high; in the 5 to 10 G's. Imagine my surprise when I saw one particular UNIX os selling for 65 freakin'... (10 Replies)
Discussion started by: mud
10 Replies
Login or Register to Ask a Question