shell script
Hello All,
Can anyone give me some idea about the shell script that will display all the files and directories with rwx permission in a particular directory Thank You |
I would try to solve this issue with 'find'. The manpage has lots of infos on your requirements.
|
could you please elaborate little more on your post
thank you |
You can do it with the find command.
Code:
find ./ -maxdepth 1 -perm -g=w From "man find" Quote:
Code:
ls -l | grep rwx |
Hello
thank that was a great help but still i couldn't write shell script completely and well i want to display all the files and folders with rwx permission for user And thank you fukawi1 |
well you would want to use to match the owners permission bits.
Code:
-user username -perm -o=rwx |
# ls -l [directory-path]
|
still couldn't get what i was trying to do
"i need to list all the files from a particular directory with rwx permission for user using a shell script" i tried to go through man but its too lengthy and kinda confusing as well anyways thank you all |
|
This will search for files in the directory you list under the user you want for files then filter with grep everything else but files with rwx permissions for the owner.
Quote:
|
1. create an empty file open it with gedit (if u have gui) or on command line open with vi
write following code #!/bin/sh ls -l -a | grep rwx [path of the directory] 2. save the file 3. chmod 755 path-of-the-script-file 4. run the script like #./script if you want user to enter the absolute path of the directory use following script: #!/bin/sh echo "please enter path of the directory" read path ls -l -a $path | grep rwx |
@singhharmeet:
#!/bin/sh echo "please enter path of the directory" read path ls -l -a $path | grep rwx the above script displays all the files with rwx permission for all users. What do we need to alter so that is shows only files with rwx permission for user only. |
grungesabin, you don't seem to understand how this site works. We're not going to do everything for you. People have given you hints as to how to write a script to do what you want and now you need to put some effort into learning and attempting to do the rest yourself. When you've attempted something, post and people will help you..
|
Quote:
Particularly considering your "too long didn't read" attitude towards the manpages. Quote:
|
Hey all
thank u so much for the help but as i have said i am extremely new to this OS that was the reason and it wasn't about my attitude but i wasn't getting everything from the manual. From next time i will keep that in mind that i put enough effort but being a newbie i think i should ask question to clear up my doubts. Thank you |
All times are GMT -5. The time now is 02:14 PM. |