Solved

Get and install KORNSHELL (ksh93)

Posted on 2002-07-21
6
283 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
Comment Utility
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
Comment Utility
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
Comment Utility
> 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
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 1

Author Comment

by:davism
Comment Utility
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
Comment Utility
RPMs are binary packages, all compiled, usually
You don't need make
0
 
LVL 1

Author Comment

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

Thanks again for the assitance and info.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

I. Introduction There's an interesting discussion going on now in an Experts Exchange Group — Attachments with no extension (http://www.experts-exchange.com/discussions/210281/Attachments-with-no-extension.html). This reminded me of questions tha…
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é.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
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.:

771 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now