Scripts execution


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Scripts execution
# 1  
Old 01-10-2007
Scripts execution

hello everybody:
i think this is really quite of dummy question.
after I write a new script, and give it the execute permission.
some times its just enough to call its name to run the script , other times I need to include ksh or ./ScriptName .
so how I can make all my scripts run by just calling their names only.


hope i managed to made it clear
thanks alot
# 2  
Old 01-10-2007
Include your current directory in PATH environment variable
Code:
PATH=$PATH":."

# 3  
Old 01-10-2007
Quote:
Originally Posted by aladdin
hello everybody:
i think this is really quite of dummy question.
after I write a new script, and give it the execute permission.
some times its just enough to call its name to run the script , other times I need to include ksh or ./ScriptName .
so how I can make all my scripts run by just calling their names only.


hope i managed to made it clear
thanks alot

do one thing
give full execute permission and copy this file into /usr/local/bin or /usr/bin so that u can execute and see this command script anywhere
# 4  
Old 01-10-2007
Quote:
Originally Posted by maheshwin
do one thing
give full execute permission and copy this file into /usr/local/bin or /usr/bin so that u can execute and see this command script anywhere
Do this (copy it to a dir which is already in your PATH) instead of anbu23's solution. That's a little bit dangerous.
# 5  
Old 01-10-2007
Quote:
Originally Posted by grial
Do this (copy it to a dir which is already in your PATH) instead of anbu23's solution. That's a little bit dangerous.
if the script is for specific purpose other than root , grials suggestion can be use d to copy file to home directory and set the PATH variable

PATH=$PATH:/home/(anyhome directory)
export $PATH

using this also can ease your work
# 6  
Old 01-10-2007
Do you have the hash-bang on the first line?

e.g. #! /bin/ksh

This tells the shell that the file contains korn script and it will automatically execute it with ksh.

So rather than:

> ksh ./somescript.ksh

you can use:

> ./somescript.ksh

This assumes that ksh is in /bin and somescript.ksh has execute permissions.

Also - be careful about arbitrarily adding other paths to your PATH variable. Just because it makes it easier doesn't make it better. I never have the current directory on the PATH - my preference is more safety over the hassle of typing ./

HTH
# 7  
Old 01-11-2007
thanks for all your replies guys.
I added the hash bang thing but didnt solve the issue.
I wasnt into adding the path thing, what i did is i added .ksh to the ScriptName.
so now its name is: test.ksh instead of test.
and it worked.
thanks again
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to check sub scripts execution?

I have a shell script which is used to get the input and have another shell script (a sub script) at the end of this shell script which is used to upload the inputs in the Oracle database. I can check the execution status of the parent script using sh -x script.sh. but this command doesn't show the... (1 Reply)
Discussion started by: srilaxman
1 Replies

2. Shell Programming and Scripting

Calling multiple scripts from another scripts

Dear all, I am working on script which call other shell scripts in a loop but problem is from second script am not able to come out. Here is the snippet:- #!/bin/bash HSFILE=/root/Test/Components.txt LOGFile=/opt/domain/AdminDomain/application/logs... (3 Replies)
Discussion started by: sharsour
3 Replies

3. UNIX for Dummies Questions & Answers

Execution problem in running multiple scripts

hi all, I have 3 individual scripts to perform the task . 2nd script should run only after the 1st script and 3rd script must run only after first 2 scripts are executed successfully. i want to have a single script that calls all this 3 scripts .this single script should execute the 2nd script... (1 Reply)
Discussion started by: Rahul619
1 Replies

4. Shell Programming and Scripting

KSH - How to call different scripts from master scripts based on a column in an Oracle table

Dear Members, I have a table REQUESTS in Oracle which has an attribute REQUEST_ACTION. The entries in REQUEST_ACTION are like, ME, MD, ND, NE etc. I would like to create a script which will will call other scripts based on the request action. Can we directly read from the REQUEST_ACTION... (2 Replies)
Discussion started by: Yoodit
2 Replies

5. Shell Programming and Scripting

Execution difference in perl scripts for windows / AIX

Hi, I have perl script abc.pl which runs perfectly fine on windows ( execution from cmd). Now i tried to execute the same perl module on the AIX server after defining the captureoutput.pm and other relevant changes. But its behaving very weirdly as a portion of the URL which is formed by... (3 Replies)
Discussion started by: slayer0611
3 Replies

6. Shell Programming and Scripting

Expect Issue Serial Forground Execution vs Concurrent Background Execution

I have an expect script that interrogates several hundred unix servers for both access and directories therein using "ssh user@host ls -l /path". The combination of host/path are unique but the host may be interrogated multiple times if there are multiple paths to test. The expect script is run... (2 Replies)
Discussion started by: twk
2 Replies

7. Shell Programming and Scripting

Changing the Bash Scripts to Bourne Scripts:URGENT

Hi, I have to write a program to compute the checksums of files ./script.sh I wrote the program using bash and it took me forever since I am a beginner but it works very well. I'm getting so close to the deadline and I realised today that actually I have to use normal Bourne shell... (3 Replies)
Discussion started by: pgarg1989
3 Replies

8. UNIX for Dummies Questions & Answers

Profile scripts versus rc scripts....

what is the difference between login and profile scripts versus the rc scripts? (1 Reply)
Discussion started by: rookie22
1 Replies

9. Shell Programming and Scripting

Scripts fails if you change its code during the execution.

So a script is working properly (tested many times) , then you add a new fine piece of code ,finaly its fails generally with a syntax error at the last line of the script. :confused:... does anybody why this happens? >uname -a HP-UX test... (4 Replies)
Discussion started by: Klashxx
4 Replies

10. Shell Programming and Scripting

Please help on shell scripts execution

I have already posted the question. Because previous post has sinked so that I have to ask the question again. I created the script and chmod it as 755. The ksh shell is in bin. Now I typed ./script_name.ksh to execute the script in the directory of that script. The return message was: Ksh:... (13 Replies)
Discussion started by: duke0001
13 Replies
Login or Register to Ask a Question