Solved

Set  KornShell environment from CShell one

Posted on 2001-06-22
11
228 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
 
LVL 38

Accepted Solution

by:
yuzh earned 50 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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

When you do backups in the Solaris Operating System, the file system must be inactive. Otherwise, the output may be inconsistent. A file system is inactive when it's unmounted or it's write-locked by the operating system. Although the fssnap utility…
Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
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.:

707 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now