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

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.

1 Like

got it. Thank you Corona688.