How to execute a script without giving x permission to the file?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to execute a script without giving x permission to the file?
# 1  
Old 01-08-2010
How to execute a script without giving x permission to the file?

How to execute a script with out giving x permission to the file?
# 2  
Old 01-08-2010
Please refere the link

---------- Post updated at 01:06 PM ---------- Previous update was at 01:05 PM ----------

https://www.unix.com/unix-dummies-que...rmissions.html
# 3  
Old 01-08-2010
suppose your file name is abcd.sh
Code:
 
sh abcd.sh

You can debug the script with additing -x
Code:
 
sh -x abcd.sh

# 4  
Old 01-08-2010
. script.sh

Jus give space between dot and script name
# 5  
Old 01-08-2010
Quote:
Originally Posted by Amit.Sagpariya
. script.sh

Jus give space between dot and script name
Not quote. A dot runs the given file in the context of the current shell. Think of it like an #include in C/C++. If the script modifies the environment, you'll have the effects in your current shell, which not always is what you want.
# 6  
Old 01-08-2010
I am aware of all the above possibilities. i am looking for a particular command which will help to run the script with out execute permission to the file.

I forgot that command.
Example, Some files like .bashrc in home directory of a normal user will use that command.
# 7  
Old 01-08-2010
Are you looking for source command ?
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Execute permission for shell script

Hi All, I am not able to figure out what is the problem with calling a shell script within a shell script. i have given all the permissions to both schell scripts. but when i am seeing the log file error is coming like weekly_us_push_rpts_tst.sh: ./vacation_quota_summary_detail.sh: Execute... (9 Replies)
Discussion started by: krupasindhu18
9 Replies

2. UNIX for Advanced & Expert Users

Allow user without dir write permission to execute a script that creates files

In our project we have several unix scripts that trigger different processes. These scripts write logs to a particular folder 'sesslogs', create output data files in a separate directory called 'datafiles' etc. Usually L1 support team re-run these scripts . We donot want L1 support team to have... (14 Replies)
Discussion started by: waavman
14 Replies

3. Solaris

Script running even after execute permission removed.

Hi All, I'm new to solaris and this site but the advices in this site have helped me a lot. Today i am facing a new issue. We have a script for BMCDashboard and this script is not supposed to run evrytime the server is booted so we disabled the services and removed the execute... (7 Replies)
Discussion started by: Rockyc3400
7 Replies

4. Shell Programming and Scripting

perl script to check read/write/execute permission for 'others'

I want to check access rights permissions not for 'user', not for 'group', but for 'others'. I want to do it by system command in which i want to use 'ls -l' and 'awk' command. I have written the following program : #!/usr/bin/local/perl #include <stdlib.h> system ("ls -l | awk... (1 Reply)
Discussion started by: shubhamsachdeva
1 Replies

5. UNIX for Dummies Questions & Answers

How I acted as other can execute file which its permission is -rw-rw-r--

I am other user who want to execute a file that its permission is -rw-rw-r-- how do I execute that file. (2 Replies)
Discussion started by: thsecmaniac
2 Replies

6. Shell Programming and Scripting

Problem with execute my file permission

Here is my script. 1 echo -n "Enter file name : " 2 read file 3 chmod 777 $file 4 && W="write = yes" || W="Write = no" 5 chmod 777 $file 6 && X="Execute = yes" || X="Execute = No" 7 chmod 777 $file 8 && R="Read = yes" || R="Read = No" ... (0 Replies)
Discussion started by: qral_hdr
0 Replies

7. Shell Programming and Scripting

Executing expect script giving message as bad interpreter: Permission denied

Hi Gurus, I am new to scripting and needs your help in expect script used for telnet. I wrote a simple script as #!/usr/bin/expect-5.43 -f spawn telnet localhost 2233 expect "password:" send "secret\r" send "i data.cnbc.com\r" send "exit\r" expect eof When I am trying to execute... (2 Replies)
Discussion started by: niks_yv
2 Replies

8. UNIX for Advanced & Expert Users

Script without read permission but execute the script

I have a script, except me no one can read the script but they can execute the script. Is it possible? (14 Replies)
Discussion started by: kingganesh04
14 Replies

9. UNIX for Dummies Questions & Answers

Giving others execute privileges

I'm trying to give everyone execute privileges on one of my small scripts. BUT, I don't want them to be able to view the file, just execute it. As USER1, I have: /usrhome/ncora/script_test CDS> $ls -la drwxrw-rw- 2 ncora ncd 96 Jan 13 15:58 . drwxrwxrwx 7 ncora ncd ... (10 Replies)
Discussion started by: FredSmith
10 Replies

10. UNIX for Dummies Questions & Answers

No permission to execute file

I am logged in as root and am trying to execute a file called x_cleanup_equdata but keep getting the message ksh: x_cleanup_equdataNEW: 0403-006 Execute permission denied. I did FTP this file from another server using GET, would this make the difference? I tried chmod 666 but still no luck. ... (2 Replies)
Discussion started by: markbeeson
2 Replies
Login or Register to Ask a Question