difference in calling shell scripts

Hi
I am getting some errors when i am running the shell script using the following syntax:
>abc.sh

but the same script works fine with the following syntax:
>sh abc.sh

wats the difference in both....please help
thanks in advance.

you need to give permission to the script to make it running without prefixing it with a 'sh' or '.'

try
$ chmod 777 abc.sh
$ abc.sh

thanks for the prompt response...
But i don't think changing the permissions will solve the problem coz script is running without the prefix but it is giving error that its not recognising the symbol "!" used in if condition.

Try adding

#!/bin/sh

as the first line, or which ever shell you want to run it under.

Thanx a lot porter...
Problem solved.

sh abc.sh two things it will do
1) it need execute permissions which ./abc.sh doent require
2)it gets invoke in new shell hereas ./abc.sh executes in tht shell only.

That's the other way around.

This is incorrect too, both launch a new shell.

I guess you are confusing ./abc.sh with . ./abc.sh, nothing that worth awaking a one year's old thread.