Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Get and install KORNSHELL (ksh93)

Posted on 2002-07-21
6
Medium Priority
?
298 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
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!

 
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

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…
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
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…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
Suggested Courses
Course of the Month11 days, 5 hours left to enroll

886 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