Solved

Get and install KORNSHELL (ksh93)

Posted on 2002-07-21
6
291 Views
Last Modified: 2013-11-13
Hi all,

I have Mandrake 8.1 but I've realized something and I've tried a .ksh file that I have from my work but that .ksh file has "print" statements in it.  

The default shell for Mandrake is bash and I can change it but ksh (korn) is not an option.  It's my understanding that the korn shell provides things like the "print" command.

I tried to setup an alias in the my local .profile file, just to test the alias concept first - where it was:
alias print='echo'

When I try print at the shell command prompt it works fine. (somewhat, anyway)

That seems to work but it doesn't carry over to child processes so when I type:

ksh testname.ksh

I still get the "print - command not found" message.  Even on the shell command prompt it the print doesn't entirely reflect what I need.

For instance:
print "\n"
\n

When it should be:
print "\n"
{CRLF}
(where {CRLF} isn't displayed but it does an actually carriage-control/line-feed)

Again, from what I've read about...commands like "print" are included in the kornshell.  That in mind and true(?), does anybody know where I can find the Korn shell and how to get that installed?

I'm a Linux/Unix newbie so please bear that in mind. :-)

Any assistance would greatly be appreciated.
0
Comment
Question by:davism
  • 3
  • 3
6 Comments
 
LVL 51

Expert Comment

by:ahoffmann
ID: 7168065
1. ksh is installed on LInux, usually. Try /usr/bin/ksh
   or /usr/bin/pdksh or /bin/ksh
2. print: command not found
   in a ksh script:
   ksh does not read /etc/profile or ~/.profile by default, you need to source it in your script like:
   . /etc/profile
   . ~/.profile
3. print "\n"  -- alias: echo "\n"
  does not work 'cause you need to distinguish between shell builtin echo (which is different for bash and ksh, unfortunatelly) and /bin/echo
   /bin/echo -e "\n"  should always work.
0
 
LVL 1

Author Comment

by:davism
ID: 7168378
Korn (ksh or pdksh) is not located in on the system.

I am trying to run the scripts as I get them without the need to have to embedd or change scripts. So, I can't really source the script to execute the profile in /etc or the like.

Also with respect to the alias, that was an attempt at the concept of the print command.  I know the actually print command will work with the alias but unless I'm missing something - I need the print statement as derived in the kornshell as I can't have qualifiers on the echo statement is I don't need them (i.e. echo -e "\n" vs echo "\n" vs a print "\n" (that actually produces a {CRLF} much like it does in PERL.)

On #1, you mentioned that ksh is "usually" installed on Linux but what if is not? (which it doesn't appear to be, at all.)  Where can I get it and how can I install it?
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 7168944
> Korn (ksh or pdksh) is not located in on the system.
then you cannot run a korn script at all. Any further question and discussion is useless, somehow.

> Where can I get it and how can I install it?
ksh is AT&T copyright, you need to purchase it.
pdksh is freeware and comes with all Linux distribution (at least those I ever have seen). Just call your favorite installation/configuration program of the distribution and select ksh and/or pdksh.
0
Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

 
LVL 1

Author Comment

by:davism
ID: 7169546
Found it!  It's pdksh and it's on CD-2.  It's an RPM.  

Are the RPM's easier to install than SOURCE and Binaries where you have to do a MAKE (if that's what it is you need to do anyway.)
0
 
LVL 51

Accepted Solution

by:
ahoffmann earned 100 total points
ID: 7169871
RPMs are binary packages, all compiled, usually
You don't need make
0
 
LVL 1

Author Comment

by:davism
ID: 7169923
Ok, thanks for the info.  I got it installed and it's working fine. :-)

Thanks again for the assitance and info.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Setting up Secure Ubuntu server on VMware 1.      Insert the Ubuntu Server distribution CD or attach the ISO of the CD which is in the “Datastore”. Note that it is important to install the x64 edition on servers, not the X86 editions. 2.      Power on th…
If you use Debian 6 Squeeze and you are tired of looking at the childish graphical GDM login screen that is used by default, here's an easy way to change it. If you've already tried to change it you've probably discovered that none of the old met…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

790 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question