The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to retain the header information of a file ahjiefreak UNIX for Dummies Questions & Answers 0 12-04-2007 07:21 PM
How to retain file permissions during FTP on Solaris 5.9 ? gauravsachan UNIX for Advanced & Expert Users 3 04-26-2007 11:19 AM
parse an arpwatch file and retain most recent mac CM64 Shell Programming and Scripting 8 04-12-2007 01:21 AM
Saving a vector to a file J.P High Level Programming 1 04-28-2002 03:28 AM
Saving a redirected file JSP UNIX for Dummies Questions & Answers 1 09-27-2001 07:52 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-11-2008
baza210 baza210 is offline
Registered User
  
 

Join Date: Dec 2008
Posts: 5
Retain file permissions when saving .sh file from internet [OS X]

Hello.
I have written a bash script that I am sharing with an OS X community I am a member of. The purpose of the script is to execute a series of commands for members without them having to get involved with Terminal, as it can be daunting for those with no experience of it at all. I have renamed the file from .sh to .command, as this allows you to execute it by double-clicking the file in the OS X file manager.
The file saves itself from my script editor [Smultron] with read and write permission only, and not executable permission; I use chmod 755 {file} to give myself execute permission, and then upload the file using ftp. Connecting to my server with ftp I then find that the file permissions have changed back to read/write, so I again use chmod in the ftp shell and change the permissions again. I thought this would have prevented the following problem, but I guess not-
When I, or anyone else, saves the file from the public domain folder I have hosted it in, the permissions are back to not being executable. Of course, this can be fixed with chmod +x, but that rather defeats the purpose of the script if they have to get involved with Terminal at all.

Could anyone please suggest a way to resolve this issue, ie how can I get the file to have persistent executable permission for all? It's driving me nuts at this stage.. I've put quite a lot of effort into the script.

Thanks
  #2 (permalink)  
Old 12-11-2008
Autocross.US's Avatar
Autocross.US Autocross.US is offline
Registered User
  
 

Join Date: Nov 2008
Location: Chesapeake, VA
Posts: 73
Not likely with ftp. Even if your receiving system had a umask of 0000, the file would not have execute permission.

You could try to use rsync over ssh. rsync has an option to preserve file permissions (-p).
  #3 (permalink)  
Old 12-11-2008
baza210 baza210 is offline
Registered User
  
 

Join Date: Dec 2008
Posts: 5
They're not downloading it by ftp though, they're just using Save Link As in Firefox or whatever.
  #4 (permalink)  
Old 12-11-2008
Autocross.US's Avatar
Autocross.US Autocross.US is offline
Registered User
  
 

Join Date: Nov 2008
Location: Chesapeake, VA
Posts: 73
After you change the perms, try tar/gzipping the file.. Then they could download it, unzip and it may have execute still...Not tested, but should work.
  #5 (permalink)  
Old 12-11-2008
baza210 baza210 is offline
Registered User
  
 

Join Date: Dec 2008
Posts: 5
Quote:
Originally Posted by jimbalaya View Post
After you change the perms, try tar/gzipping the file.. Then they could download it, unzip and it may have execute still...Not tested, but should work.
Delightful. That works perfectly. Not ideal, but will do for now thanks
Closed Thread

Bookmarks

Tags
shell script, shell scripting, unix scripting, unix scripting basics

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:18 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0