How do i execute script in the current shell


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How do i execute script in the current shell
# 1  
Old 06-12-2006
Question How do i execute script in the current shell

How do i run a shell script or perl script with in the context of a current shell.
I know that i can use command source. but we can't pass any arguments to
our script if we use source command as it takes only one argement i.e filename

Is there any way to run a script in the current shell itself and i want to pass arguments
to that script.
Current shell should be reflected accoding to my changes in the script.

Can somebody help me please.
# 2  
Old 06-12-2006
.

execute as
Code:
. script.sh

Note the period at the beginning.
# 3  
Old 06-12-2006
I tried but i am getting the following error

/bin/.: Permission denied.

What is that period means what i have to do to get permission.
# 4  
Old 06-12-2006
nothing about period

The period says to execute it in the current shell. There should be a space between the period and the script name.
Code:
. /the/script/path/script.sh

# 5  
Old 06-12-2006
i gave space also. still i am getting the same error.

[pcnt-nareshkg:nareshkg]/home/nareshkg/script> . /home/nareshkg/BOSDELIVERY/script/
test.sh
/bin/.: Permission denied.

Is there any env to set to use this.
# 6  
Old 06-12-2006
error

it look like there is a '.' file in the /bin directory which is being referenced by this invocation and for which you dont have permissions. Check if there is any file as such in the /bin directory.

You can unset the PATH variable and execute the script again.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Detect current shell inside a script

I wish to print my current shell which happens to be bash in my script check.sh more check.sh echo $0 echo `ps -p $$` But instead of printing it prints check.sh i.e the name of the script for both the commands. Can you please suggest how to print the current shell i m on inside the... (2 Replies)
Discussion started by: mohtashims
2 Replies

2. Shell Programming and Scripting

Finish current script and execute next script

Hi, I've come accross a situation where I need to exit from current shell script at the same time I need to start/activate another shell script. How can I do that in KSH ?? Need help !! For example, my script is as below #!/bin/ksh paramFile="/home/someXfile.lst" ] && <<Here I... (1 Reply)
Discussion started by: R0H0N
1 Replies

3. Shell Programming and Scripting

Batch script to execute shell script in UNIX server

Hi team, My requirement is to transfer pdf files from windows machine to unix server and then from that unix server we should sftp to another server. I have completed the first part i.e From windows to using to unix server with the help of psftp.exe code: psftp user@host -pw password <... (1 Reply)
Discussion started by: bhupeshchavan
1 Replies

4. Shell Programming and Scripting

Execute C program in Current shell

Hello, I have a c program executable which I need to run inside a shell script. But the c program runs in a subshell because of which all the actions done by the c program is not available to the current shell. Is there any way to execute a C program binary executable in the current shell? (4 Replies)
Discussion started by: sachinverma
4 Replies

5. Shell Programming and Scripting

Dos batch script to execute unix shell script

Can anyone help me with a dos batch script to execute a shell script residing in an unix server. I am not able to use ssh. Thanks in advance (2 Replies)
Discussion started by: Shri123
2 Replies

6. Shell Programming and Scripting

How to use ssh execute other shell script on other host (shell script include nohup)?

i want use ssh on the host01 to execute autoexec.sh on the host02 like following : host01> ssh host02 autoexec.sh autoexec.sh include nohup command like follwing : nohup /home/jack/deletedata.sh & after i execute ssh host02 autoexec.sh one the host01. i can't found deletedata.sh... (1 Reply)
Discussion started by: orablue
1 Replies

7. Shell Programming and Scripting

Execute commands from script in current bash session

I have a file as follows: cat /etc/mxg/ssh-hostsmx.example1.com.au:2225 mx2.example2.com.au:2225 mx.example3.com.au:2225 mail.example4.com.au:2225 mail.example5.org.au:2225 mail.example6.com.au:2225I want to dynamically create aliases for quick access to these servers from bash. I wrote... (4 Replies)
Discussion started by: jelloir
4 Replies

8. Shell Programming and Scripting

Execute unix shell script to text file using the script

Hi all, I am beginner in UNIX...I want to use unix shell script to create text.file...I know how to use using by command...can anybody tell me for the script? Thanks i changed the threads title from "tex file" to "text file", because "tex" would probably be misunderstood as reference to... (4 Replies)
Discussion started by: mastercar
4 Replies

9. Shell Programming and Scripting

current line number in shell script

Hi I am using korn shell is there a built in or ny other way to get the current line number so i can write the current line number to the logfile to aid in debugging like logmsg $lineno $date logmsg is a helper function that helps in logging messages to a log file regards (3 Replies)
Discussion started by: xiamin
3 Replies

10. Shell Programming and Scripting

how do i get current bandwidth usage via shell script?

hello unix-people. can u please tell me how i can get the current bandwidth usage of my machine on shell into variables? thanks a lot (2 Replies)
Discussion started by: scarfake
2 Replies
Login or Register to Ask a Question