Re: [OT] 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
Reply to: