Solved

Get and install KORNSHELL (ksh93)

Posted on 2002-07-21
6
293 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
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

Guide to Performance: Optimization & Monitoring

Nowadays, monitoring is a mixture of tools, systems, and codes—making it a very complex process. And with this complexity, comes variables for failure. Get DZone’s new Guide to Performance to learn how to proactively find these variables and solve them before a disruption occurs.

Question has a verified solution.

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

Suggested Solutions

It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Create a Windows 10 custom Image with custom task bar and custom start menu using XML for deployment.
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.:
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses

752 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