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.
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
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 ./
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
For the most part, "which binary" should help. This won't catch everything, though. For example, you might (unknowingly) have "f" aliased to "ls -alF". If you name your script "f", the alias "f" would be interpreted before the script "f".
Probably the most popular way to avoid having your script names interfering with existing binaries is to use some variation of ".sh" as a suffix.