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
bash and ksh: variable lost in loop in bash? estienne Shell Programming and Scripting 2 08-25-2008 02:09 PM
passing variable from bash to perl from bash script arsidh Shell Programming and Scripting 10 06-04-2008 12:25 PM
Why generate "ash and bash" different output for same bash script? s. murat Shell Programming and Scripting 0 05-26-2008 07:19 AM
python vs bash - verbose mode penguin-friend Shell Programming and Scripting 2 01-27-2006 10:05 AM
PAM Vs Trusted mode in HP-UX wilsonchan1000 UNIX for Dummies Questions & Answers 0 07-26-2004 06:58 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 10-24-2008
anduzzi anduzzi is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 48
ksh to bash mode

Hi guys...
I have a ksh shell by default, so when I login to my unix box, all my .profile statements gets executed(including the aliases).
But for some reasons(may be not comfortable using ksh), I would always switch to BASH(in the same session but as a child process) but in the process I am loosing all the aliases which were active in my parent (ksh)...
I understand that by typing BASH at the cmd line, I am starting a child process which should atleast inherit the charateristics(aliases etc) of the immediate parent....But in this case, its not happening.
Can somebody explain me this scenario?...and If there is a best(minimal) way to have the similar behavior as the parent, what would that be?...

PS: Please don't advice to DOT the profile once again !

-Anduzzi
  #2 (permalink)  
Old 10-24-2008
radoulov's Avatar
radoulov radoulov is offline Forum Staff  
addict
  
 

Join Date: Jan 2007
Location: Варна, България / Milano, Italia
Posts: 2,794
And why don't you just change your login shell?

If you cannot change your login shell add the following in your .profile:

Code:
[ -x /path/to/bash ]&&exec /path/to/bash -l

Last edited by radoulov; 10-24-2008 at 12:04 PM..
  #3 (permalink)  
Old 10-24-2008
anduzzi anduzzi is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 48
Thanks for the input.
Could you please eloberate on this command?..I need to know what exactly I
[ -x /path/to/bash ]&&exec /path/to/bash -l
am doing here...

-Anduzzi
  #4 (permalink)  
Old 10-24-2008
radoulov's Avatar
radoulov radoulov is offline Forum Staff  
addict
  
 

Join Date: Jan 2007
Location: Варна, България / Milano, Italia
Posts: 2,794
-x checks if you have permission to execute the file (the bash shell in this case), if the test returns true, substitutes (the exec builtin) your current shell with bash run as a login shell (the -l switch).
  #5 (permalink)  
Old 10-24-2008
anduzzi anduzzi is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 48
Thx...
Does this substitution pre-vail multiple sessions?....or
when I log out of the current session, the login shell will be back to KSH again?..which means I am dealing with a single session ONLY with out effecting other developers !!!

-Anduzzi
  #6 (permalink)  
Old 10-24-2008
radoulov's Avatar
radoulov radoulov is offline Forum Staff  
addict
  
 

Join Date: Jan 2007
Location: Варна, България / Milano, Italia
Posts: 2,794
If you put that command in .profile it will affect everyone using that initialization file (the same username). If you put that in .kshrc or whatever file you use for your interactive sessions, it will affect all interactive sessions that use that rc file.
  #7 (permalink)  
Old 10-24-2008
anduzzi anduzzi is offline
Registered User
  
 

Join Date: Aug 2008
Posts: 48
Alright...I see your suggestion here...
But, I don't have any .kshrc(or any kind of such interactive programs) in my HOME which forces me to change the .profile.

Am I missing something?..

-Anduzzi
Sponsored Links
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 05:48 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language translation by Google.
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