Sponsored Content
Full Discussion: Automating Linux Script
Homework and Emergencies Homework & Coursework Questions Automating Linux Script Post 302856303 by Scott on Monday 23rd of September 2013 02:53:33 PM
Old 09-23-2013
chmod -R 755 * would recursively change every file and directory in the current directory (except anything beginning with a . (dot) in the current directory) to have permissions rwxr-xr-x.

chmod -R 740 [TPAM]*/* would recursively change every file and directory in any directory beginning with "T", "P", "A" or "M" in the current directory (except any file or directory beginning with . (dot) in exactly the directory beginning with "T", "P", "A" or "M" in the current directory) to have a permission of rwxr-----.

Code:
$ mkdir Tx Px Ax Mx              

$ touch Tx/.T1 Px/P1 Ax/.Ax Mx/Mx

$ find . -ls
2138774        0 drwxr-xr-x    6 scott            staff                 204 Sep 23 20:48 .
2139783        0 drwxr-xr-x    3 scott            staff                 102 Sep 23 20:48 ./Ax
2139820        0 -rw-r--r--    1 scott            staff                   0 Sep 23 20:48 ./Ax/.Ax
2139784        0 drwxr-xr-x    3 scott            staff                 102 Sep 23 20:48 ./Mx
2139821        0 -rw-r--r--    1 scott            staff                   0 Sep 23 20:48 ./Mx/Mx
2139782        0 drwxr-xr-x    3 scott            staff                 102 Sep 23 20:48 ./Px
2139819        0 -rw-r--r--    1 scott            staff                   0 Sep 23 20:48 ./Px/P1
2139781        0 drwxr-xr-x    3 scott            staff                 102 Sep 23 20:48 ./Tx
2139818        0 -rw-r--r--    1 scott            staff                   0 Sep 23 20:48 ./Tx/.T1

$ chmod -R 740 [TPAM]*/*

$ find . -ls            
2138774        0 drwxr-xr-x    6 scott            staff                 204 Sep 23 20:48 .
2139783        0 drwxr-xr-x    3 scott            staff                 102 Sep 23 20:48 ./Ax
2139820        0 -rw-r--r--    1 scott            staff                   0 Sep 23 20:48 ./Ax/.Ax
2139784        0 drwxr-xr-x    3 scott            staff                 102 Sep 23 20:48 ./Mx
2139821        0 -rwxr-----    1 scott            staff                   0 Sep 23 20:48 ./Mx/Mx
2139782        0 drwxr-xr-x    3 scott            staff                 102 Sep 23 20:48 ./Px
2139819        0 -rwxr-----    1 scott            staff                   0 Sep 23 20:48 ./Px/P1
2139781        0 drwxr-xr-x    3 scott            staff                 102 Sep 23 20:48 ./Tx
2139818        0 -rw-r--r--    1 scott            staff                   0 Sep 23 20:48 ./Tx/.T1

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

automating sftp script

I have to write an automated sftp script which uses password authentication method to access the remote server. I want to pass the password as a parameter or to be included in the script itself, so that when i run the sftp script, it should not prompt me to enter the password. Thanks in advance... (1 Reply)
Discussion started by: Rajeshsu
1 Replies

2. Shell Programming and Scripting

Automating Logform Command in a script

Hi all I am trying to create a script to automate the creating of filesystems. The problem I am having is as follows:- After creating the Log Logical Volume, I want to format it, using the logform command. The Logform command expects user intervention, by typing 'y' and 'enter' to continue.... (2 Replies)
Discussion started by: TheDoc
2 Replies

3. UNIX for Dummies Questions & Answers

cron ? automating a script

Hi all. basically i need to run a script every 30 minutes. my script is simply an error report: errpt thats it, is there anyway to make this happen every 30 minutes without having to type errpt in, the script will get bigger as i add more things to do but just need to know how to... (8 Replies)
Discussion started by: hassanj
8 Replies

4. Shell Programming and Scripting

Help in automating dates in ksh script

I need to run a command at the end of a backup job and this command will produce a report of what my backup jobs have collected in the previous day. The real problem is that this binary works with absolute dates only, so I should have to modify the script every single time I need it to work. It... (1 Reply)
Discussion started by: italia1971luca
1 Replies

5. Shell Programming and Scripting

Automating Interactive script

I have a script that will install software on all remote host. At the end of the script it starts the install.sh part and goes into a interactive mode asking Yes or No questions and prompting to add a username and password. My question is how can I script this so that these questions are... (7 Replies)
Discussion started by: soupbone38
7 Replies

6. Shell Programming and Scripting

Automating A Perl Script over a database

Dear Scripting Gods I've never done shell scripting before and have only recently got to grips with Perl, so apologies for my naivity. I've written a perl program which takes in two files as arguments (these are text documents which take in the information I need) The perl program spits out a... (1 Reply)
Discussion started by: fraizerangus
1 Replies

7. Shell Programming and Scripting

Help with automating a bash script

Hi Guys, There are some emails going deferred as we got some new IP's from our ISP. So I was trying to manually copy the deferred mail and forward it to our sales team so that they can contact our client. I am new to this script thing, but luckily I was able to write the code to extract the data... (1 Reply)
Discussion started by: linuxrulz
1 Replies

8. Shell Programming and Scripting

automating a perl script

Hi, I have a perl script that takes in 2 numerical values as ARGV. perl script.pl parameter1 num1 num2 in my case I have 1000's of num1 and num2. I can have them in separate files. Please let me know how to automate this run using shell scripting or using awk, so that I don't have to... (4 Replies)
Discussion started by: Lucky Ali
4 Replies

9. Shell Programming and Scripting

Automating Crontab through script??

is it possible to automate crontab through script... I ll be getting the data i.e. cron entries from DB. (5 Replies)
Discussion started by: nikhil jain
5 Replies

10. Shell Programming and Scripting

Automating Linux Script

I want to automate the creation or processing of the following: Directory and subdirectory creation for your scenario company Files in each of the directories Symbolic links from 2 subdirectories to their parent directories Setting appropriate file permissions for the directories and... (1 Reply)
Discussion started by: ekglag2
1 Replies
CHGRP(1)							   User Commands							  CHGRP(1)

NAME
chgrp - change group ownership SYNOPSIS
chgrp [OPTION]... GROUP FILE... chgrp [OPTION]... --reference=RFILE FILE... DESCRIPTION
Change the group of each FILE to GROUP. With --reference, change the group of each FILE to that of RFILE. -c, --changes like verbose but report only when a change is made -f, --silent, --quiet suppress most error messages -v, --verbose output a diagnostic for every file processed --dereference affect the referent of each symbolic link (this is the default), rather than the symbolic link itself -h, --no-dereference affect symbolic links instead of any referenced file (useful only on systems that can change the ownership of a symlink) --no-preserve-root do not treat '/' specially (the default) --preserve-root fail to operate recursively on '/' --reference=RFILE use RFILE's group rather than specifying a GROUP value -R, --recursive operate on files and directories recursively The following options modify how a hierarchy is traversed when the -R option is also specified. If more than one is specified, only the final one takes effect. -H if a command line argument is a symbolic link to a directory, traverse it -L traverse every symbolic link to a directory encountered -P do not traverse any symbolic links (default) --help display this help and exit --version output version information and exit EXAMPLES
chgrp staff /u Change the group of /u to "staff". chgrp -hR staff /u Change the group of /u and subfiles to "staff". GNU coreutils online help: <http://www.gnu.org/software/coreutils/> Report chgrp translation bugs to <http://translationproject.org/team/> AUTHOR
Written by David MacKenzie and Jim Meyering. COPYRIGHT
Copyright (C) 2013 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. SEE ALSO
The full documentation for chgrp is maintained as a Texinfo manual. If the info and chgrp programs are properly installed at your site, the command info coreutils 'chgrp invocation' should give you access to the complete manual. GNU coreutils 8.22 June 2014 CHGRP(1)
All times are GMT -4. The time now is 06:06 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy