Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Get and install KORNSHELL (ksh93)

Posted on 2002-07-21
6
Medium Priority
?
295 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
Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

 
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 400 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

In my business, I use the LTS (Long Term Support) versions of Linux. My workstations do real work, and so I rarely have the patience to deal with silly problems caused by an upgraded kernel that had experimental software on it to begin with from a r…
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 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…
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

670 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