/etc/motd is not displayed for non-interactive login
when i login to the the terminal via putty i get the message of the day displayed ok.
but if im already logged on to my console using gnome and right click on the desktop = > open in terminal , i don't see the message of the day.
how can i fix that?
Responses
Hi Asaf,
/etc/motd is only displayed in login shells. To make it display in non-login shells, you can, for example, create a short script in /etc/profile.d/. Let's say motd.sh. Put something like the following in it (the test is just to make sure a terminal is actually attached, and /etc/motd is readable):
[ -n "$TERM" -a -r /etc/motd ] && cat /etc/motd
That is correct (the double display) since motd is a "default" of ssh.
You could add some logic to determine if the process is "gnome-terminal" and only display in that case, or determine if it is a remote connection, etc...
I'm trying to research which bash built-in would be of the most relevance in this case.
Else, you could do something like, add the following to your .bashrc
set | grep ^GNOME > /dev/null && cat /etc/motd
The problem with that, however, is whether there is always a "GNOME_
Also - I have started to abandon modifying /etc/profile and instead have started to look at /etc/profile.d/
and I now have a new favorite thing for the day.... ;-) I might even add cowsay to my .bashrc now.
# [ -f /usr/bin/cowsay ] && echo "Well lookee here" | cowsay -f tux
__________________
< Well lookee here >
------------------
\
\
.--.
|o_o |
|:_/ |
// \ \
(| | )
/'\_ _/`\
\___)=(___/
cowsay is pretty amusing ;-)
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
