LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 01-29-2013, 04:27 AM   #1
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 486

Rep: Reputation: 31
/bin/ksh: bad interpreter: No such file or directory


Hi,

I use the RH Linux and the bash shell. I got a ksh script from my partner. As I run this script I got error as follow:
Code:
-bash: ./compileExample: /bin/ksh: bad interpreter: No such file or directory
Any suggestion?

Regards
 
Old 01-29-2013, 04:45 AM   #2
linosaurusroot
Member
 
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 742
Blog Entries: 2

Rep: Reputation: 192Reputation: 192
Does your file have DOS-style line endings? Convert with dos2unix.
 
Old 01-29-2013, 04:58 AM   #3
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,797
Blog Entries: 4

Rep: Reputation: 285Reputation: 285Reputation: 285
Check whether you've ksh shell installed or not, as:-
Code:
~$ which ksh
Also check what's script interpreter, (it's set on top of your script):
Code:
#!/bin/ksh
 
Old 01-29-2013, 05:03 AM   #4
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 486

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by linosaurusroot View Post
Does your file have DOS-style line endings? Convert with dos2unix.
I've converted it with dos2unix. But this doesn't help.
 
Old 01-29-2013, 05:04 AM   #5
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 486

Original Poster
Rep: Reputation: 31
Quote:
Originally Posted by shivaa View Post
Check whether you've ksh shell installed or not, as:-
Code:
~$ which ksh
Also check what's script interpreter, (it's set on top of your script):
Code:
#!/bin/ksh
which ksh returns:
Code:
/usr/bin/which: no ksh in (/usr/local/bin:/bin:/usr/bin:/home/msg61/bin)
Teh script interpreter is
Code:
#!/bin/ksh
This can be found at the beginning of the script.
 
Old 01-29-2013, 05:07 AM   #6
thomas2004ch
Member
 
Registered: Aug 2009
Posts: 486

Original Poster
Rep: Reputation: 31
And here is the script:
Code:
#!/bin/ksh

if [ "$JAVA_HOME" = "" ] ; then
   echo "[ERROR] JAVA_HOME not set"
   exit 1
elif [ ! -f $JAVA_HOME/bin/javac ] ; then
   echo "[ERROR] javac in $JAVA_HOME/bin/ not found. Wrong JAVA_HOME=$JAVA_HOME??"
   exit 1
fi

if [ "$JBOSS_HOME" = "" ] ; then
   echo "[ERROR] JBOSS_HOME not set"
   exit 2
fi

# Classpath erweitern
MYCLASSPATH="."

if [ ! -f ./axis2-wsclient-gen.jar ] ; then
   echo "[ERROR] axis2-wsclient-gen.jar in ./ not found"
   exit 13
fi
MYCLASSPATH="$MYCLASSPATH:axis2-wsclient-gen.jar"

if [ ! -f ./axis2-wrapper-gen.jar ] ; then
   echo "[ERROR] axis2-wrapper-gen.jar in ./ not found"
   exit 13
fi
MYCLASSPATH="$MYCLASSPATH:axis2-wrapper-gen.jar"

if [ ! -f ./BPClient.jar ] ; then
   echo "[ERROR] BPClient.jar in ./ not found"
   exit 13
fi
MYCLASSPATH="$MYCLASSPATH:BPClient.jar"

if [ ! -f $JBOSS_HOME/bin/client/jboss-client.jar ] ; then
   echo "[ERROR] jboss-client.jar in $JBOSS_HOME/bin/client/ not found"
   exit 13
fi
MYCLASSPATH="$MYCLASSPATH:$JBOSS_HOME/bin/client/jboss-client.jar"

for f in $(ls lib/axis2/*.jar)
do
    MYCLASSPATH="$MYCLASSPATH:$f"
    #print "File: $f"
done

export MYCLASSPATH

$JAVA_HOME/bin/javac -encoding ISO-8859-1 -classpath $MYCLASSPATH -d bin src/de/msg/businesspartner/client/sample/jboss/*.java
 
Old 01-29-2013, 05:27 AM   #7
TobiSGD
Moderator
 
Registered: Dec 2009
Location: Hanover, Germany
Distribution: Gentoo
Posts: 15,357
Blog Entries: 2

Rep: Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980Reputation: 3980
This is a ksh script. To interpret it you need ksh. You may be able to run it with bash if you replace the ksh in the first line, but I can't say if it will work as intended. The easiest way would be to just install ksh.
 
1 members found this post helpful.
Old 01-29-2013, 06:00 AM   #8
linosaurusroot
Member
 
Registered: Oct 2012
Distribution: OpenSuSE,RHEL,Fedora,OpenBSD
Posts: 742
Blog Entries: 2

Rep: Reputation: 192Reputation: 192
Installing ksh would usually be done with a package manager: "sudo zypper install pdksh" or similar.
 
Old 01-29-2013, 07:27 AM   #9
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,225

Rep: Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021Reputation: 2021
Assuming 'RH Linux' means RHEL, use
Code:
yum install ksh
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
/bin/bash^M: bad interpreter: no such file or directory stevesk Slackware 18 03-07-2012 11:58 AM
/usr/bin/perl^M: bad interpreter: No such file or directory colindek Ubuntu 17 12-13-2011 09:32 AM
/usr/bin/perl^M: bad interpreter: No such file or directory colindek Linux - Newbie 8 12-12-2011 05:23 PM


All times are GMT -5. The time now is 11:22 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration