Difference in executing the script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Difference in executing the script
# 1  
Old 02-13-2015
Difference in executing the script

Hi Team,

a silly question.

Let's say i have a script called xyz.ksh

what is the difference in executing the script as follows?
./xyz.ksh
ksh xyz.ksh

Thanks
# 2  
Old 02-13-2015
The first one reads the first line of the script, and uses it to decide which shell to use.

If it's #!/bin/ksh it will use KSH, if it's #!/usr/bin/csh it will use csh, if it's #!/bin/sh it will use any variety of bourne shell, etc, etc.

When you do ksh script you avoid that entirely, and force it to use a particular shell.
This User Gave Thanks to Corona688 For This Post:
# 3  
Old 02-13-2015
got it. Thank you Corona688.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Executing Oracle script from UNIX Script

Hi, I am new to UNIX and want to execute oracle script from unix script. I have written below script but i am getting below error. #!/bin/bash file="/home/usr/control/control_file1" while read line do #$line=@$line #echo $line sqlplus tiger/scott@DB @$line exit #echo "$line" done... (3 Replies)
Discussion started by: vipin kumar rai
3 Replies

2. UNIX for Dummies Questions & Answers

Script dosent exits after executing the script

Hi i wrote a script which dosent exists after executing any help #!/bin/bash netstat -ptlen | grep 10000 if ; then echo "Hive Thrift server is running" exit 0 else echo "Hive Thrift server is down Trying to Bring up the service" | mail -s "ALERT" team@domain.com `nohup hive... (7 Replies)
Discussion started by: vikatakavi
7 Replies

3. UNIX for Dummies Questions & Answers

Difference Between executing llike ./myscript.ksh and . ./myscript.ksh

Hi , What is the diffence between executing the script like ./myscript.ksh . ./myscript.ksh I have found 2 difference but could not find the reason 1. If i export a variable in myscript.ksh and execute it like . ./myscript.ksh the i can access the other scripts that are present in... (5 Replies)
Discussion started by: max_hammer
5 Replies

4. Shell Programming and Scripting

Use of ./ in executing a script.

Hi Guys, Hope you are doing well out there. Can you please let me know why do we use "./" to run a shell script? Is it to run the script in the current shell or something else? What if I have already defined a bang in the script say #!/bin/ksh and then running the script as... (2 Replies)
Discussion started by: singh.chandan18
2 Replies

5. Shell Programming and Scripting

Variables of executed script available in executing script

Hi, I have a script get_DB_var.ksh which do a data base call and get some variables as below: sqlplus -silent $user/$pass@dbname <<END select col1, col2, col3 from table_name where col4=$1; exit; END Now I want to access all these variables i.e.... (9 Replies)
Discussion started by: dips_ag
9 Replies

6. Shell Programming and Scripting

What is the difference executing a script with . in the front versus not putting a "."

Hi All, I know this has been discussed a lot but still I need some more answers. I am running this is ksh on AIX 5.3 I believe putting a "." in front of the script will start a new shell, is that correct?? I have a script which override some PATH variables and it does not do that... (3 Replies)
Discussion started by: Hangman2
3 Replies

7. UNIX for Advanced & Expert Users

Executing a shell script from windows;script present in unix

I need to execute a shell script kept in unix machine from windows. User id, password area available. For eg. There's a shell script wich moves all the logs kept in my home directory to a directory named LOGS. Now i need to get this done through windows; either using a batch file, or java... (4 Replies)
Discussion started by: rajneesh_kapoor
4 Replies

8. Shell Programming and Scripting

script not executing

Hi , Kindly advice whats wrong with this script. It is not executing. ...# #!/bin/ksh find. -name "b.log" if ; then echo "1" fi ...# Thanks (5 Replies)
Discussion started by: himvat
5 Replies

9. UNIX for Dummies Questions & Answers

Difference between executing a shell using sh and .

Is there any difference in executing the shell using sh and . and ./. I had a shell script and i observed that anyone is ale to execute the script eith sh even without having the execute permission.how is so? (2 Replies)
Discussion started by: soumyo_das
2 Replies

10. Shell Programming and Scripting

Difference in Executing a Script

Can anyone tell me the difference between the following execution ways: 1) . ./filename 2) ./filename Also when to use the either. (8 Replies)
Discussion started by: Shivdatta
8 Replies
Login or Register to Ask a Question