Script Permissions


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Script Permissions
# 1  
Old 07-23-2012
Script Permissions

I have a script were I issue the following command:
Code:
perl -p -i -e "s/$v31a/$db2/" $dbn31

My script fails with permission error. However, at the command line I can edit the directory in question. I am using uname 002 in my script. So, why can i update manually but not in a script?

Last edited by Franklin52; 07-24-2012 at 08:39 AM.. Reason: Please use code tags for data and code samples, thank you
Harleyrci
# 2  
Old 07-23-2012
Depends what your script is actually doing. What are the values of those variables?

Also: The ability to edit a directory does not necessarily mean the ability to edit the files inside it.
# 3  
Old 07-23-2012
Quote:
Originally Posted by Harleyrci
I have a script were I issue the following command:
perl -p -i -e "s/$v31a/$db2/" $dbn31

My script fails with permission error. However, at the command line I can edit the directory in question. I am using uname 002 in my script. So, why can i update manually but not in a script?
You mean umask 002 ?

And you can try sed for the job: sed -i "s/$v31a/$db2/" $dbn31
# 4  
Old 07-23-2012
Yes, the perl command is trying to update a file in place. From the command line, I can update the same file without permission error. So what is the difference?
Harleyrci
# 5  
Old 07-23-2012
Depends what your script is actually doing. What are the values of those variables?
# 6  
Old 07-23-2012
The values are file names, and the current value and what the value should be changed to.
Harleyrci
# 7  
Old 07-24-2012
What file names? You may be hitting special characters which cause sed to barf or do funny things.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Script for mkdir with permissions

Hello, I'm pretty new to scripting and trying to do a simple (well, I thought so) administrator task. I'm using bash. I want to create 10 directories under the one directory and apply permissions at the same time. I've worked out the make directories part: mkdir /userdata/folder{1..50}... (7 Replies)
Discussion started by: jimothy007
7 Replies

2. Shell Programming and Scripting

Help on script to change permissions

Hi All I have the following script that is supposed to change permissions of incoming files to a directory, but it does not seem to do what I want, please can you help: mkdir -p /tmp/tmpdir find /moneta_polled01/sgsn/ -exec ls -l {} \; |grep -v rwxrwxrwx |awk '{print $9}' >... (4 Replies)
Discussion started by: fretagi
4 Replies

3. Shell Programming and Scripting

Help on script to change permissions

Hi I have written the following script that later I want to put in cron,: #!/bin/bash _find="/usr/bin/find" _paths="/moneta_polled01/mediation_gsm /moneta_polled01/mediation_mmsc" for d in $_paths do $_find $d -type f -exec chmod 777 {} \; done but it does not seem to be... (8 Replies)
Discussion started by: fretagi
8 Replies

4. Shell Programming and Scripting

How to check file permissions from a script.

hello, I have to write a script to run the other script inside it.So iam planning to write like this? first check the perimissions of the file. Alogorthim ---------- if(!filepermissions == execute) then echo" Permissions denined" else execute the script. file name is : load_mf.sh... (1 Reply)
Discussion started by: rajkumar_g
1 Replies

5. Shell Programming and Scripting

Permissions script

Hi there, I've been having some frustrating problems with a permissions script. Basically I want it to to determine what permissions the owner, group and everybody has for the file passed in. Here's what I've got: #!bin/bash echo -n "Enter filename: " read file owner=$( ls -l $file | cut... (7 Replies)
Discussion started by: user_invalid
7 Replies

6. Shell Programming and Scripting

Call other script having different Permissions

Oops, infact i caught my mistake.... (1 Reply)
Discussion started by: suhail.sadaqat
1 Replies

7. UNIX for Dummies Questions & Answers

Permissions to files using batch script.

Hi all, I am using a batch script that ftps the compressed xml files to the Unix environment from the Windows environment and i perform this using the below line of coding: echo cd %VAR_TR_FTP_DIR% > %TR_FTP_BATCH_FILE BatchNum% Echo lcd "%VAR_TR_SOURCE_PATH_BatchNum%">> %TR_FTP_BATCH_FILE... (1 Reply)
Discussion started by: Codesearcher
1 Replies

8. UNIX for Dummies Questions & Answers

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... (2 Replies)
Discussion started by: DevotedPupil
2 Replies

9. Shell Programming and Scripting

Modify Perl script to work with txt - Permissions script

Hi I have this code, and i want work with a ls -shalR output in .txt What i need read to do this?? Where start? #!/usr/bin/perl # Allrights- A perl tool for making backups of file permissions # Copyright (C) 2005 Norbert Klein <norbert@acodedb.com> # This program is free... (1 Reply)
Discussion started by: joangopan
1 Replies

10. 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
Login or Register to Ask a Question