OpenQNX :: The QNX Community Portal

May 13, 2008 - 02:12 PM
Google
  Web openqnx.com   
     Create an account Home · Submit News · QNX Forums · QNX Download · Search   
_
Main Menu
Who's Online
There are 68 unlogged users and 1 registered user online.

You can log-in or register for a user account here.

Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
maschoen
Post subject: .profile for pterm shells?  PostPosted: Sep 18, 2007 - 01:26 AM
QNX Master


Joined: Jun 25, 2003
Posts: 974

When logging in, the ksh shell reads and executes the commands in .profile.

In Photon when you bring up a pterm, you get a shell, but it does not execute .profile.

Does anyone know how to remedy this situation?
 
 View user's profile Send private message Send e-mail Visit poster's website  
Reply with quote Back to top
xtang
Post subject: RE: .profile for pterm shells?  PostPosted: Sep 18, 2007 - 02:21 AM
QNX Master


Joined: Jul 18, 2002
Posts: 288

put this line in .profile

export ENV=$HOME/.kshrc

create a $HOME/.kshrc file, put whatever command you want to run
in there.
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
maschoen
Post subject: RE: .profile for pterm shells?  PostPosted: Sep 18, 2007 - 05:48 AM
QNX Master


Joined: Jun 25, 2003
Posts: 974

Thank you for the reply. Unfortunately this does not work. As I mentioned in the original post, .profile is not read in when pterm creates sh, only when login creates it. Any other ideas?
 
 View user's profile Send private message Send e-mail Visit poster's website  
Reply with quote Back to top
noc
Post subject:   PostPosted: Sep 18, 2007 - 06:03 AM
Senior Member


Joined: Jul 06, 2002
Posts: 1629

It should just work fine.
As you pointed out, .profile is only read when you login. This means after you modified your .profile as xtang suggested, you need to logout/login again so that the .profile change can take effect. With the .profile change, your pterm (or any shell session) will read/source $HOME/.kshrc file.
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
maschoen
Post subject:   PostPosted: Sep 18, 2007 - 08:07 AM
QNX Master


Joined: Jun 25, 2003
Posts: 974

If make the changes described, and then reboot and login using the Photon login screen .profile is not read in.
Are you suggesting that I bring down photon and login, then start Photon again?
Or could you mean, that on each pterm, I have to logout and login?
 
 View user's profile Send private message Send e-mail Visit poster's website  
Reply with quote Back to top
Tim
Post subject:   PostPosted: Sep 18, 2007 - 01:52 PM
Senior Member


Joined: Mar 10, 2004
Posts: 514

Maschoen,

I believe you need to bring down photon (or rather go back to the login screen on photon) and then re-login to photon.

pterm AFAIK always creates a new terminal as the user that initially logged into to photon. It doesn't appear to run an actual 'log in' like a text console does (otherwise you'd have to enter your username and password each time).

If you want a .profile to be executed each time a user creates a new pterm your going to have to add the '-l' option to pterm. You can do this by right clicking on the 'terminal' button, click setup and then after the pterm add the -l.

Tim
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
maschoen
Post subject:   PostPosted: Sep 18, 2007 - 02:06 PM
QNX Master


Joined: Jun 25, 2003
Posts: 974

Tim,

Thanks, I'll try bringing down photon and re-logging in. It seems to defeat the whole purpose of booting into Photon but at least I would only have to do it once per-boot. As far as the -l option, I'd have to login to each pterm I brought up, which again defeats the purpose.
 
 View user's profile Send private message Send e-mail Visit poster's website  
Reply with quote Back to top
maschoen
Post subject:   PostPosted: Sep 18, 2007 - 02:41 PM
QNX Master


Joined: Jun 25, 2003
Posts: 974

Well this works, so thanks to all.
This will save me thousands of keystrokes over the next year.
I might note, when I put an alias in .profile, it is not available in the pterms,
however when I put it in a .kshrc file, as xtang suggested, it does.
 
 View user's profile Send private message Send e-mail Visit poster's website  
Reply with quote Back to top
Tim
Post subject:   PostPosted: Sep 18, 2007 - 05:17 PM
Senior Member


Joined: Mar 10, 2004
Posts: 514

Maschoen,

If you add the '-l' option to pterm you don't actually log in using your username and password each time you create a new pterm. Photon automatically passes that info to the pterm. All it does is makes sure you run your .profile file each time a pterm is created.

If the .kshrc file accomplishes the same thing then you can forgo the -l option.

Tim
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
maschoen
Post subject:   PostPosted: Sep 18, 2007 - 08:19 PM
QNX Master


Joined: Jun 25, 2003
Posts: 974

Thanks again Tim, I'll try it. I checked the parameters of pterm before I posted, and I have to say that the description of -l is a little confusing to me, "Start shell as a login shell". Does sound like it will put up a login prompt.
 
 View user's profile Send private message Send e-mail Visit poster's website  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by PNphpBB2 © 2003-2007 The PNphpBB Group
Credits
All logos and trademarks in this site are property of their respective owners. The comments are property of their posters.
Powered by OpenQNX: The QNX Community Portal Site
QNX and the QNX logo are registered trademarks of QNX Software Systems.