Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'A simple way to open files in X11 applications' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A simple way to open files in X11 applications
Authored by: n8gray on Sep 20, '07 10:34:47AM
Standard practice is to put environment variables (PATH, MANPATH, etc.) and aliases into your .bashrc. Your .bash_profile should contain start-up commands, like bash 'shopt' calls, a nice daily 'fortune', and any 'stty' calls.

Interesting. The various rc files I've inherited have always had it the other way around, though they could certainly be wrong.

When the login vs. non-login shell issue comes up it's always presented as, "for login shells these files get loaded and for non-login shells these ones do," but what I've never heard explained is why anybody should care about login vs. non-login shells. I understand why interactive vs. non-interactive is important, but what's the difference if a shell is login or non-login?

[ Reply to This | # ]

A simple way to open files in X11 applications
Authored by: Nem on Sep 21, '07 10:36:59AM

The simplest case I can give you about why you would want to differentiate is this: I'm on host-a and I want to run a "mybackup" script that I wrote on host-b. I can do this:

ssh host-b /some/weird/path/mybackup

But typing in that path is cumbersome. If "/some/weird/path" is defined as a part of my PATH in my .bashrc, I don't need to type it, I can just do:

ssh host-b mybackup

If my PATH is defined in my .bash_profile, this second ssh command will fail ("mybackup not found").

Another important reason is if you use X11 most of the time (as I do, even on my Mac), you need access to the 'xauth' program for remote windows to work properly. The path to the X11 binaries is often NOT included in the system default PATH, thus you need to put it into your .bashrc. Again, if you have your PATH in your .profile, then this command won't work (for several reasons):

ssh host-b xterm


The next question is, why would you put anything in your .bash_profile? And actually, my .bash_profile is pretty sparse. The main thing I have are things relating to the shell. Things like "shopt -s cdspell" only make sense when a shell is interactive. Another thing I have is a program that spits out any calendar appointments I have for that day. You definitely would not want that spat out every time you 'ssh' to a box to run a command - you only want something like that when your session interactive.

I've seen a lot of programs spit out a message along the lines of "add this PATH statement to your .bash_profile" - it's unfortunate, and many people won't really notice, but that's not the way this was all designed to work. It's a simple distinction, but an important one if your stuff isn't working the way you want it to!

---
Nem W. Schlecht
http://geekmuse.net/



[ Reply to This | # ]