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

x
?
Solved

Set  KornShell environment from CShell one

Posted on 2001-06-22
11
Medium Priority
?
252 Views
Last Modified: 2010-04-21
Hi all,

I would like to know how can I create a Shell script which allows me to define an environment in Korn Shell i.e. :
- where I can run all ksh commands
- where variables such PS1, PS2 are defined as I want,
..

Thanks in advance
0
Comment
Question by:Richard Coffre
  • 4
  • 4
  • 3
11 Comments
 
LVL 11

Expert Comment

by:griessh
ID: 6218170
You can always start a srcipt with the shell type you want to use, like:

#!/bin/ksh

ksh uses the .env for for settings.

Is that enough information? Feel free to ask if you need more ...

======
Werner
0
 
LVL 1

Author Comment

by:Richard Coffre
ID: 6218202
Thanks Werner

But what I want it's a kind of login script I can run whenever I want to switch for a CShell environment to a KornShell one because where I work CShell is the default shell.

Is it more explicit now ?
0
 
LVL 11

Expert Comment

by:griessh
ID: 6218333
OK, let's try that again

1) You can always switch by running "ksh", that will give you a kshell (using the .env file)

2) If you prefer the kshell, why don't you ask you sys admin to switch you to ksh as login shell. (Do you HAVE to use csh?)

======
Werner
0
Independent Software Vendors: 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 38

Accepted Solution

by:
yuzh earned 200 total points
ID: 6223019
Hi pyxos,

   You don't need a script to setup your ksh ENVs, but you do need to have a set of ksh setup file to put under you home dir, (eg .profile, .kshrc
you put all you ksh env setup infor in these 2 files)

   When you want to use ksh, you type in:
   ksh <enter>
   . $HOME/.profile <enter>
   . $HOME/.kshrc <enter>

   Note: there is a space between . and $HOME.

   These should work, I use it all the time.

    Cheers!

Regards
    yuzh

   
0
 
LVL 1

Author Comment

by:Richard Coffre
ID: 6223486
Thanks a lot, it works well, but one last question :
what is the best configuration when you want to fill the files .profile and .kshrc ?

So far I only use .profile therefore I want to know what I have to put in .profile on one hand, and in .kshrc in another hand ?


0
 
LVL 38

Expert Comment

by:yuzh
ID: 6223728
Hi pyxos ,

    There is no limit about what to put on these files, you can use .profile
only if you prefer.

    I put something like:
    MAIL
    OPENWINHOME
    DTWINHOME
    PATH
    MANPATH
    LD_LIBRARY_PATH
    export ENV=$HOME/.kshrc
    in my .profile

    And put my other  ENV settings in .kshrc, eg:
     PAGER
     LIBPATH
     PWD
    PS1
    EDITOR
    # Alias settings
    # Display settings
    # user define functions
     in .kshrc file

     Cheers!

Regards
     yuzh



     
     
     
     

 
   
   
0
 
LVL 11

Expert Comment

by:griessh
ID: 6224416
pyxos

I'm a bit disappointed. I told you to run 'ksh' to switch over to the kshell. Running .profile and .kshrc is certainly a way to do it, but not the natural way. If you login (using ksh as your shell) your .profile is used, for each ksh session it will use the .env file.

I'm not sure if you tried my suggestion at all ...

======
Werner
0
 
LVL 1

Author Comment

by:Richard Coffre
ID: 6224584
Hi Werner,

I post a question for you.
0
 
LVL 38

Expert Comment

by:yuzh
ID: 6225897
Hi Werner,

    For some user the default login shell have to be sh or csh/tcsh do
do their job, eg root. or in some Engerring company, and these shells
may not be the user's prefer working shell, they have to switch to the
other shell to do their routine task, when they use some special software, they have to use their default shell.

   Regs
      yuzh
0
 
LVL 11

Expert Comment

by:griessh
ID: 6225913
yuzh

Thanks for the comment, I am fully aware of the use of the cshell. pyxos doesn't seem to be an expert root user, so I just asked if it would be possible to switch. I worked 2 years in cshell and switched until I dared to ask the Almighty System Administator if it would be ... by any change ... only if it would be a big deal ... possible to get a kshell. He said "Sure!" 2 minutes later I had my kshell and now everybody in my group is using the kshell. Just a bit of a background for my suggestion ...

======
Werner
0
 
LVL 1

Author Comment

by:Richard Coffre
ID: 6226502
Because I realize I got 2 unix experts answering my questions, I would like to the pros and cons between CShell and Korn Shell ?

Is there really an advantage to use one more than the other ?

Thanks in advance
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Hello fellow BSD lovers, I've created a patch process for patching openjdk6 for BSD (FreeBSD specifically), although I tried to keep all BSD versions in mind when creating my patch. Welcome to OpenJDK6 on BSD First let me start with a little …
Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
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.:
Suggested Courses
Course of the Month12 days, 14 hours left to enroll

971 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