homepage Welcome to WebmasterWorld Guest from 54.196.168.78
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
Subscribe to WebmasterWorld

Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
Forum Library, Charter, Moderators: coopster & jatar k & phranque

Perl Server Side CGI Scripting Forum

    
Shell Script to Install Package
BoneHeadicus




msg:435030
 12:42 am on Feb 13, 2001 (gmt 0)

I have never done this but I saw it in a script I downloaded and thought it was a great idea to save headaches and time.

I have a set of standard scripts I use in all my sites, same folders, same names every time.

How would I write a simple shell script (.sh) to chmod perms on these.

For instance:

directory "Big" needs to be set to 777
index.pl needs to be 755,
booger1.pl needs to be 766
booger2.pl needs to be 755

and then folder "Hairy" inside folder "Big" needs to be 777

Then another folder "Ziggy Stardust" and everything below it needs to be 755.

Any ideas??

 

Marcia




msg:435031
 3:20 am on Feb 13, 2001 (gmt 0)

eewwwwwwww!

>>Any ideas??

Changing the filenames is a start. foo1.pl and foo2.pl work well. Folder1 nd Folder2 also. :)

BoneHeadicus




msg:435032
 3:34 am on Feb 13, 2001 (gmt 0)

>>>Marcia

I've been a little brother as long as I can remember...just got a knack for it :)

sugarkane




msg:435033
 10:57 am on Feb 13, 2001 (gmt 0)

Anything you can do at a command line you can do in a script, just list the commands one per line.

So, your script would look something like this:

#!/bin/bash
chmod 755 foo1.pl
chmod 666 foo2.pl
chmod -R 755 "Ziggy Stardust"

the -R on the last command makes the chmod recursive ie it'll change the perms on everything below that directory. (On some flavours of unix it'll be -r instead)

Of course, whether your host will give you access to bash is another matter ;)

sugarkane




msg:435034
 10:58 am on Feb 13, 2001 (gmt 0)

<oops post="duplicate"></oops>

BoneHeadicus




msg:435035
 1:10 pm on Feb 13, 2001 (gmt 0)

Thanks SugarKane.

I was messing with it last nite and just went ahead and listed each and every line out and it worked.

DataPipe seems to be a pretty good host. I can also run cron too. Which brings me to the next question...is there a way to work a cron tab into that routine as well?

PS I ran mine without the shebang...is that ok?

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Perl Server Side CGI Scripting
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved