Solved

Set  KornShell environment from CShell one

Posted on 2001-06-22
11
231 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
Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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
 
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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
FreeBSD on EC2 FreeBSD (https://www.freebsd.org) is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
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…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

821 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