• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 258
  • Last Modified:

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
0
Richard Coffre
Asked:
Richard Coffre
  • 4
  • 4
  • 3
1 Solution
 
griesshCommented:
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
 
Richard Coffree-commerce Product ManagerAuthor Commented:
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
 
griesshCommented:
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
yuzhCommented:
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
 
Richard Coffree-commerce Product ManagerAuthor Commented:
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
 
yuzhCommented:
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
 
griesshCommented:
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
 
Richard Coffree-commerce Product ManagerAuthor Commented:
Hi Werner,

I post a question for you.
0
 
yuzhCommented:
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
 
griesshCommented:
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
 
Richard Coffree-commerce Product ManagerAuthor Commented:
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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 4
  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now