FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 04-15-2008, 03:23 AM
"Vikki Roemer"
 
Default How to add fortune output to terminal

On Mon, Apr 14, 2008 at 8:08 PM, s. keeling <keeling@nucleus.com> wrote:
> Vikki Roemer <vikki.roemer@gmail.com>:
>
> > In my experience, I've never had fortune break scp, but maybe I've
> > just been lucky.
> >
> > But, if it does cause problems, just remove it and add it to
> > .bash_profile instead.
>
> .bash_profile is for setting up global env vars. .bashrc is for doing
> things for interactive ("login") sessions. Batch jobs are not login
> sessions. xterm -ls is a login shell (runs your startup scripts).

Oh, ok. I had them confused. Sorry.

> Cf. "su" vs. "su -". The former gives user root privs with user's
> env. The latter runs root's startup scripts and clobbers the
> user's process environment (in that child proc).

Ah. I always wondered what the difference was. (I always use 'su',
my classmates use 'su -')

--
Vikki Roemer

Registered Linux user #280021

"Sometimes the lights all shinin' on me;
Other times I can barely see.
Lately it occurs to me what a long, strange trip its been."
-- Grateful Dead, "Truckin'"


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 04-15-2008, 04:43 AM
NN_il_Confusionario
 
Default How to add fortune output to terminal

On Tue, Apr 15, 2008 at 02:08:02AM +0200, s. keeling wrote:
> .bash_profile is for setting up global env vars. .bashrc is for doing
> things for interactive ("login") sessions.

this is completely different from what I understand by reading man bash
(section FILES, and also search for "INVOCATION" in all the man page).

A common pratice is to source .bashrc from .bash_profile , but it is not
a necessity so each one should check such files in $HOME

--
Chi usa software non libero avvelena anche te. Digli di smettere.
Informatica=arsenico: minime dosi in rari casi patologici, altrimenti letale.
Informatica=bomba: intelligente solo per gli stupidi che ci credono.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 04-16-2008, 12:12 AM
"s. keeling"
 
Default How to add fortune output to terminal

NN_il_Confusionario <pinkof.pallus@tiscalinet.it>:
> On Tue, Apr 15, 2008 at 02:08:02AM +0200, s. keeling wrote:
> > .bash_profile is for setting up global env vars. .bashrc is for doing
> > things for interactive ("login") sessions.
>
> this is completely different from what I understand by reading man bash
> (section FILES, and also search for "INVOCATION" in all the man page).

I've been fighting this stuff for so long, I'm convinced the manpage
author never understood it. zsh seems to get it, but that's another
level of complexity ...

> A common pratice is to source .bashrc from .bash_profile , but it is not
> a necessity so each one should check such files in $HOME

Another common practice is to set PS1 in .bash_profile, then call
.bashrc from .bash_profile. Then, in .bashrc you'll see:

# Hopefully, /etc/profile didn't do this (also). If so,
# .bash_profile should unset PS1 first.
#
if [ ! -z "$PS1" ]; then

# interactive shell startup stuff.

fi

The intent being to not clutter up the environment any more than is
necessary.

Nowadays, this is pretty irrelevant stuff, until something gets
confused and breaks.


--
Any technology distinguishable from magic is insufficiently advanced.
(*) http://blinkynet.net/comp/uip5.html Linux Counter #80292
- - http://www.faqs.org/rfcs/rfc1855.html Please, don't Cc: me.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 04-16-2008, 11:06 PM
 
Default How to add fortune output to terminal

s. keeling wrote:
> Another common practice is to set PS1 in .bash_profile, then call
> .bashrc from .bash_profile.
> if [ ! -z "$PS1" ]; then

The PS1 is set by default for interactive shells and not set for
non-interactive shells. So the test for $PS1 works without needing to
set it. This is in the default Debian /etc/skel/.bashrc too.

> The intent being to not clutter up the environment any more than is
> necessary.

Note: Some versions of bash read the .bashrc when it determines that
it is started over a remote shell. By splitting the .bashrc into an
interactive and non-interactive section then aliases can be loaded
over a remote shell and made available to the command while not
breaking things for a non-interactive environment. Not that I would
advocate doing that. The feature was removed from the bash upstream
due to various problems. Debian Etch has patches specifically for
this situation. See /usr/share/doc/bash/README.Debian.gz .

Bob
 
Old 04-17-2008, 02:19 AM
"s. keeling"
 
Default How to add fortune output to terminal

Bob Proulx <bob@proulx.com>:
> s. keeling wrote:
> > Another common practice is to set PS1 in .bash_profile, then call
> > .bashrc from .bash_profile.
> > if [ ! -z "$PS1" ]; then
>
> The PS1 is set by default for interactive shells and not set for
> non-interactive shells. So the test for $PS1 works without needing to
> set it. This is in the default Debian /etc/skel/.bashrc too.

Thanks, didn't know that. I've always clobbered PS1 first, not caring
what it was set to. I guess I should instead test to see if it's set
to what I set it to.

> > The intent being to not clutter up the environment any more than is
> > necessary.
>
> Note: Some versions of bash read the .bashrc when it determines that
> it is started over a remote shell. By splitting the .bashrc into an
> interactive and non-interactive section then aliases can be loaded
> over a remote shell and made available to the command while not
> breaking things for a non-interactive environment. Not that I would
> advocate doing that. The feature was removed from the bash upstream
> due to various problems. Debian Etch has patches specifically for
> this situation. See /usr/share/doc/bash/README.Debian.gz .

I distinctly remember this behaviour, and its subsequent
disappearance. Thanks for explaining that. I wondered why it had
disappeared.


--
Any technology distinguishable from magic is insufficiently advanced.
(*) http://blinkynet.net/comp/uip5.html Linux Counter #80292
- - http://www.faqs.org/rfcs/rfc1855.html Please, don't Cc: me.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 04-17-2008, 06:21 AM
Martin Schulze
 
Default How to add fortune output to terminal

Bob Proulx wrote:
> s. keeling wrote:
> > Another common practice is to set PS1 in .bash_profile, then call
> > .bashrc from .bash_profile.
> > if [ ! -z "$PS1" ]; then
>
> The PS1 is set by default for interactive shells and not set for
> non-interactive shells. So the test for $PS1 works without needing to
> set it. This is in the default Debian /etc/skel/.bashrc too.
>
> > The intent being to not clutter up the environment any more than is
> > necessary.
>
> Note: Some versions of bash read the .bashrc when it determines that
> it is started over a remote shell. By splitting the .bashrc into an
> interactive and non-interactive section then aliases can be loaded
> over a remote shell and made available to the command while not
> breaking things for a non-interactive environment. Not that I would
> advocate doing that. The feature was removed from the bash upstream
> due to various problems. Debian Etch has patches specifically for
> this situation. See /usr/share/doc/bash/README.Debian.gz .

Another way to do this is:

if [ -n "$PS1" -a "$TERM" != "dumb" ]; then
# aliases and the like for interactive use
else
# non-intreactive
fi

TERM=dumb is set by dumb terminal emulations such as M-x shell in Emacs,
in case you wonder. Colour definitions should be outside.

Regards,

Joey

--
Let's call it an accidental feature. -- Larry Wall

Please always Cc to me when replying to me on the lists.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 04-18-2008, 05:38 PM
 
Default How to add fortune output to terminal

Martin Schulze wrote:
> Please always Cc to me when replying to me on the lists.
> ...
> Another way to do this is:
>
> if [ -n "$PS1" -a "$TERM" != "dumb" ]; then
> # aliases and the like for interactive use
> else
> # non-intreactive
> fi
>
> TERM=dumb is set by dumb terminal emulations such as M-x shell in Emacs,
> in case you wonder. Colour definitions should be outside.

Hmm... Almost. If it is an alias that I want for interactive use
then I would want it in an emacs interactive shell too. Which means
that I wouldn't want to key off of TERM=dumb in that case since it
wouldn't be there in that interactive session.

I just put anything that I always want loaded above the PS1 test line
(shown as defaulted in /etc/skel/.bashrc):

# always loaded
[ -z "$PS1" ] && return
# conditionally loaded

And most of the time I am not really worried about if I have a version
(old upstream or new patched) of bash which reads the file or not.
Most of the time I won't notice. If I do notice then I will already
know what is going on and deal with it on the fly. (shrug)

Bob


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 

Thread Tools




All times are GMT. The time now is 01:32 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org