Link to home
Start Free TrialLog in
Avatar of Richard Coffre
Richard CoffreFlag for France

asked on

Set KornShell environment from CShell one

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
Avatar of griessh
griessh
Flag of United States of America image

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
Avatar of Richard Coffre

ASKER

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 ?
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
ASKER CERTIFIED SOLUTION
Avatar of yuzh
yuzh

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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 ?


Avatar of yuzh
yuzh

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



     
     
     
     

 
   
   
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
Hi Werner,

I post a question for you.
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
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
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