troubleshooting Question

How to force user to place 'ksh' before running a shell script

Avatar of tindavid
tindavid asked on
Shell ScriptingSystem Programming
7 Comments1 Solution1129 ViewsLast Modified:
Here is the issue, I have written a ksh script that is to be run both Unix and Linux, since the script containts logic and features that only "korn" will give better/valid result, so what I want is:

whenever this program is excuted, make sure it will be running like below:

$ ksh myprog.sh

if user enter $ sh myprogram.sh
the program will prompt the use to enter "ksh myprogram.sh" instead.

Why I am asking for this,  so I don't need to care wheather the default shell for a give user is a bash/csh/

What I want is logic in "myprogram.sh" to check if user does enetr the ksh before the $0 !

Thank you,

David


ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 7 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 7 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros