The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Switch + stirng DNAx86 Shell Programming and Scripting 5 01-09-2008 10:10 AM
switch login sharif UNIX for Advanced & Expert Users 1 12-12-2007 04:03 AM
Switch abey High Level Programming 12 06-27-2006 07:11 PM
switch from csh to ksh veeracer UNIX for Dummies Questions & Answers 1 11-03-2004 06:28 PM
can you switch neer45 Shell Programming and Scripting 3 12-05-2001 08:54 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-03-2004
veeracer veeracer is offline
Registered User
  
 

Join Date: Nov 2004
Location: Denver
Posts: 5
switch from csh to ksh

My UNIX SA requires that we start in CSH. I like to use KSH because most of my experience is in that shell. I added ksh to the end of my .login script which does take me into KSH but I would like to automatically execute my .profile to setup my aliases.

I cannot use a .shell file because I need to execute other scripts in my .login that do not run in ksh.

Any thought on how to automatically execute my .profile when switching shells? I am using Solaris.


Thanks in advance,


Steve
  #2 (permalink)  
Old 11-05-2004
jim mcnamara jim mcnamara is online now Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,717
for the last line of your script try:
Code:
exec /bin/ksh -i
The "exec" and the "-i" force ksh to assume you are logging in.

It will source /etc/profile, then try $HOME/.profile
  #3 (permalink)  
Old 11-05-2004
RTM's Avatar
RTM RTM is offline Forum Advisor  
Hog Hunter
  
 

Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
Jim - that doesn't work going from csh to ksh on Solaris (8 and 2.6) as far as running .profile or .kshrc - even though the man page seems to say it would.
  #4 (permalink)  
Old 11-05-2004
veeracer veeracer is offline
Registered User
  
 

Join Date: Nov 2004
Location: Denver
Posts: 5
It works!
  #5 (permalink)  
Old 11-05-2004
RTM's Avatar
RTM RTM is offline Forum Advisor  
Hog Hunter
  
 

Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
Unhappy

Great - now you have me stumped on why it doesn't work on my servers!
  #6 (permalink)  
Old 11-05-2004
veeracer veeracer is offline
Registered User
  
 

Join Date: Nov 2004
Location: Denver
Posts: 5
Woops. I was replying to the wrong forum. Here is how to do it:

setenv ENV .profile
/bin/ksh
  #7 (permalink)  
Old 11-05-2004
RTM's Avatar
RTM RTM is offline Forum Advisor  
Hog Hunter
  
 

Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
Okay, that worked. At least for .profile but doesn't run .kshrc (which I would have thought it would run it also but no big deal). Did the exec /bin/ksh -i work for you?
(I've been trying to get something to work over the last day in spare time - would have thought it would have been easier!)
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:04 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0