Visit Our UNIX and Linux User Community


file permissions using shell scripting


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting file permissions using shell scripting
# 8  
Old 10-02-2007
i have to start someware Smilie
# 9  
Old 10-02-2007
Laziness???

If you are not allowed to use the correct tools for the job then I suggest you kick up a fuss.
Unix utilities are there to be used not ignored because of someone's prejudices.
You have my sincere sympathies
# 10  
Old 10-02-2007
i assume he is doing this, because he wants me to grasp some concepts, he did say i can use sed and awk once am confirtable doing stuff without them Smilie

i have only being using unix for about 2 weeks now after all.

can we get to the problem in hand please Smilie

Quote:
is it possible to redirect the string of permissions like rwxr-wr-- to a variable/tmp?
and can the find function be used to display something like the 1st string of 10 characters from a line?

Last edited by barbus; 10-02-2007 at 08:53 AM..
# 11  
Old 10-02-2007
not exactly, but something to start with:
Code:
#!/bin/ksh

echo -n "please enter file name : "
read file

echo "      READ WRITE EXECUTE"
getfacl "${file}" | while IFS=':' read what junk perm
do
   case "${what}" in
      user|group|other)
             echo "${what} $(echo ${perm} | sed -e 's/[rwx]/ YES /g' -e 's/-/ NO /g')"
             ;;
   esac
done


Last edited by vgersh99; 10-02-2007 at 10:23 AM..
# 12  
Old 10-02-2007
that help me out a LOT, thank you, thank you all Smilie

Previous Thread | Next Thread
Test Your Knowledge in Computers #521
Difficulty: Medium
0b110010000001 = 2^11 + 2^10 + 2^7 + 2^0
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Read csv file, convert the data and make one text file in UNIX shell scripting

I have input data looks like this which is a part of a csv file 7,1265,76548,"0102:04" 8,1266,76545,"0112:04" I need to make the output data should look like this and the output data will be part of text file: 7|1265000 |7654899 |A| 8|12660000 |76545999 |B| The logic behind the... (6 Replies)
Discussion started by: RJG
6 Replies

2. UNIX for Dummies Questions & Answers

Shell script to read lines in a text file and filter user data Shell Programming and Scripting

sxsaaas (3 Replies)
Discussion started by: VikrantD
3 Replies

3. Shell Programming and Scripting

To check the file permissions using python scripting

Hi, For a particular set of files, am trying to check if they are writable. i.e., checking whether they are having permissions greater than 755. Am able to check this using the statement: "if (os.path.isfile(FILE_PATH) and (os.stat(FILE_PATH).st_mode & 0777) == 0777):" But the problem... (1 Reply)
Discussion started by: arjun_arippa
1 Replies

4. Programming

To check the file permissions using python scripting

Hi, For a particular set of files, am trying to check if they are writable. i.e., checking whether they are having permissions greater than 755. Am able to check this using the statement: "if (os.path.isfile(FILE_PATH) and (os.stat(FILE_PATH).st_mode & 0777) == 0777):" But the problem here... (0 Replies)
Discussion started by: arjun_arippa
0 Replies

5. Homework & Coursework Questions

Shell scripting/working with a file

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: 1. Write a shell script that will work with a file from the command line. The program should: a. Check... (4 Replies)
Discussion started by: Jagst3r21
4 Replies

6. Shell Programming and Scripting

Shell scripting - need to arrange the columns from multiple file into a single file

Hi friends please help me on below, i have 5 files like below file1 is x 10 y 20 z 15 file2 is x 100 z 245 file3 is y 78 z 23 file4 is x 100 (3 Replies)
Discussion started by: siva kumar
3 Replies

7. Shell Programming and Scripting

file operations in shell scripting

hi All, my query... 1.I Have to search for the files in the root directory. 2.i have to search for a pattern in all the files in the root directory and then replace them with a new pattern. 3.Rename the file Explanation: if ABC is the root folder and has 3 subfolders and there are 15... (9 Replies)
Discussion started by: adityamahi
9 Replies

8. Shell Programming and Scripting

.def file in HP-UX Shell scripting

Hi Pals, I need some information related .def file in HP-Ux shell scripting. What actaully a .def file contains. It is having all definitions of some functions. But what is the relationship between a .def file and shell script. Can anyone give some examples. Thanks in Advance. Best... (1 Reply)
Discussion started by: manu.vmr
1 Replies

9. Shell Programming and Scripting

difference between AIX shell scripting and Unix shell scripting.

please give the difference between AIX shell scripting and Unix shell scripting. (2 Replies)
Discussion started by: haroonec
2 Replies

10. UNIX for Dummies Questions & Answers

file activity (open/closed) file descriptor info using KORN shell scripting

I am trying to find a way to check the current status of a file. Such as some cron job processes are dependent on the completion of others. if a file is currently being accessed / modified or simply open state I will wait until it is done being processed before attempting the next process on that... (3 Replies)
Discussion started by: Gary Dunn
3 Replies

Featured Tech Videos