Console/SSH/X: How to tell?

Lennart Sorensen lsorense-1wCw9BSqJbv44Nm34jS7GywD8/FfD2ys at public.gmane.org
Mon Jun 22 13:09:27 UTC 2009


On Fri, Jun 19, 2009 at 03:36:40PM -0400, Marc Lanctot wrote:
> I use pal for my calendaring now and I'd like my xterms to open up with
> the output from pal. However, if I add it to .bashrc, then when I try
> to copy things to/fro remotely scp fails because there is output
> generated by my .bashrc. 
> 
> So what I'd like to do is detect if the session is an xterm/console, or
> through interactive ssh.. and output the calendar in these cases but
> not in cases where I scp or execute a command remotely. 
> 
> Can I do this? If so, how?

Use the profile instead of bashrc.  bashrc is used for both interactive
and non interactive sessions, while profile should only be interactive.
Hence ssh will give you output, and scp will not.

No need for anything complicated checking variables and all that.

-- 
Len Sorensen
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list