Changing permissions in a shell script


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Changing permissions in a shell script
# 1  
Old 02-23-2009
Question Changing permissions in a shell script

Hi All,

I have a shell script which we keep on changing permissions on a On-Demand Basis-->for e:g--from 400(Read only) to 740(Execute permission) etc.
Is there any way by which I can view the history of the script?-->I am interested in finding out the date-time stamps when the script's permission was last modified.
Please let me know if there is any command that we can use in this case.
# 2  
Old 02-23-2009
Hope the below codes can help you...

Code:
stat -c %x filename
 
stat -c %y filename
 
stat -c %z filename

where

Code:
%x---> Time of last access
 
%y---> Time of last modification
 
%z---> Time of last change

Go through man stat for more details
# 3  
Old 02-23-2009
If you are modifing permissions on an on-demand basis as you describe, I recommend that you modify your script to record this information somewhere so that you have a log of such actions.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

changing directory permissions

Hi, Im getting this annoying problem on file permission when I copy a folder to a mounted external directory. the files inside the copied folders become all executable. I tried to search for ways how to undo the permission over the web but to no avail. tried this one but it doesnt change a... (2 Replies)
Discussion started by: ida1215
2 Replies

2. Shell Programming and Scripting

changing the permissions

HI, I wann give permissions to a folder which contains multiple folders..... how can i give permissions to all folder at a time tat means if i give permissions to main folder it the same permissions has to take on all the folders in the main folders how can i use one command to give... (1 Reply)
Discussion started by: nani1984
1 Replies

3. OS X (Apple)

rsync is changing permissions

I have the following command. This is meant to download all files from my server to the Downloads folder of my startup drive: /usr/local/bin/rsync -avve ssh --numeric-ids --delete --ignore-errors -R grndlvl@myserver.com:/usr/home/./grndlvl grndlvl@myserver.com:/usr/home/./grndlvl/mail_boxes/... (8 Replies)
Discussion started by: rlinsurf
8 Replies

4. Shell Programming and Scripting

HELP changing file permissions

does anyone know how to write a script that will change file permissions. because the Admin blocked me from altering any of my files im only allowed to read and i heard a script like this can bypass it but i dont know how to write it. Display current users. Display user Ids only. Display... (10 Replies)
Discussion started by: live2learn
10 Replies

5. Shell Programming and Scripting

How to run cmds after changing to a new env (shell) in a shell script

Hi, I am using HP-UNIX. I have a requirement as below I have to change env twice like: cadenv <env> cadenv <env> ccm start -d /dbpath ccm tar -xvf *.tar ccm rcv .... mv *.tar BACKUP but after I do the first cadenv <env> , I am unable to execute any of the later commands . ... (6 Replies)
Discussion started by: charlei
6 Replies

6. Shell Programming and Scripting

Shell script permissions

Hi, I'm trying to execute a shell script from application (Informatica). The script works fine when I execute it from command line but fails when executed from Informatica. The tricky part is that there is other scripts in the same folder that can be executed succesfully from both command line... (1 Reply)
Discussion started by: tmikahan
1 Replies

7. UNIX for Dummies Questions & Answers

Changing file permissions

Is there a way to change a unix user's default file permissions so that when he creates a file, by default permissions are 777??? Thanks! (7 Replies)
Discussion started by: FredSmith
7 Replies

8. UNIX for Advanced & Expert Users

Changing permissions of a user

So I need to change the permissions of my user account. I can access the root account on the server, but don't know how to change the permissions of my user account. I was advised to try 'userconf' to see if I am part of a group, but I dunno how that works. ANyone who knows how to see the... (3 Replies)
Discussion started by: achink125
3 Replies

9. Shell Programming and Scripting

Changing Permissions

Is it possible to change the permissons for an entire directory in one shot? I'm telneting on to a linux server. ...just a beginner-- --Paul (4 Replies)
Discussion started by: pdavid
4 Replies

10. Shell Programming and Scripting

changing file permissions

Use the following to Change permission of fileB (fileB could be fileB*) to change its permission same as the permission of fileA. chmod `ls -l fileA | awk '{pr int "u+", substr($1,2,1), substr($1,3,1), substr($1,4,1), ",g+", substr($1,5,1), substr($1,6,1), substr($1,7,1), ",o+",... (0 Replies)
Discussion started by: gagansharma
0 Replies
Login or Register to Ask a Question