Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
fortune display in console or terminal
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
fubard
n00b
n00b


Joined: 11 Jun 2004
Posts: 52

PostPosted: Wed Jul 07, 2004 3:34 pm    Post subject: fortune display in console or terminal Reply with quote

hi people, im sure a few of us have used slackware and remember how the a fortune or quote was always displayed once u login, does anybody know how to do this? im sure the pkg is called fortune... but how do i set it to display once i login to my box?
_________________
if you spend enough time on it, eventually it all makes sense.
Back to top
View user's profile Send private message
Dolio
l33t
l33t


Joined: 17 Jun 2002
Posts: 650

PostPosted: Wed Jul 07, 2004 3:37 pm    Post subject: Reply with quote

I think the easiest way would be to put it in your .bashrc or .bash_profile. If you do that, it will print a fortune whenever you log into a console (regular console or xterm).
_________________
They don't have a good bathroom to do coke in.
Back to top
View user's profile Send private message
Celtis
l33t
l33t


Joined: 05 Jul 2003
Posts: 737

PostPosted: Wed Jul 07, 2004 3:39 pm    Post subject: Reply with quote

The package you're looking for is called forune-mod. If you do an emerge -s fortune you can see all the categories of quotes that are available (Futurama is a must).

After you've installed it try:
Code:
echo "fortune" >> ~/.bash_profile
to have a fortune quote appear whenever you login or open a new terminal.

EDIT: Changed .bashrc to .bash_profile as mentioned by trott


Last edited by Celtis on Fri Jul 09, 2004 8:36 am; edited 1 time in total
Back to top
View user's profile Send private message
fubard
n00b
n00b


Joined: 11 Jun 2004
Posts: 52

PostPosted: Wed Jul 07, 2004 3:43 pm    Post subject: Reply with quote

thanks :P
_________________
if you spend enough time on it, eventually it all makes sense.
Back to top
View user's profile Send private message
trott
n00b
n00b


Joined: 09 Jul 2004
Posts: 2

PostPosted: Fri Jul 09, 2004 8:17 am    Post subject: Reply with quote

True enough, but when you add it to your .bashrc, you can no longer use scp to copy files between the machines. Although you do get a remote fortune everytime you try to transfer something :)
so what would be the correct place to add the fortune command to?
Back to top
View user's profile Send private message
Celtis
l33t
l33t


Joined: 05 Jul 2003
Posts: 737

PostPosted: Fri Jul 09, 2004 8:33 am    Post subject: Reply with quote

EDIT: Nevermind, I see you've fixed it :)

Last edited by Celtis on Fri Jul 09, 2004 8:35 am; edited 1 time in total
Back to top
View user's profile Send private message
trott
n00b
n00b


Joined: 09 Jul 2004
Posts: 2

PostPosted: Fri Jul 09, 2004 8:33 am    Post subject: Reply with quote

'use the search' :)
Quote:

/etc/skel/.bashrc wrote:
# This file is sourced by all *interactive* bash shells on startup. This
# file *should generate no output* or it will break the scp and rcp commands.


If you want output when you login you should add the fortune command to ~/.bash_profile otherwise scp won't work.
Back to top
View user's profile Send private message
gnuageux
Veteran
Veteran


Joined: 17 Apr 2004
Posts: 1201

PostPosted: Fri Jul 09, 2004 12:16 pm    Post subject: Reply with quote

Yeah, I wouldnt add it to .bash_profile (or rc) have you tried creating ~/.hush_login?
_________________
The realOTW: http://forums.realotw.org/index.php

Registered Linux user#364538
Back to top
View user's profile Send private message
Ignignokt
n00b
n00b


Joined: 08 Jan 2003
Posts: 59

PostPosted: Fri Jul 09, 2004 2:22 pm    Post subject: Reply with quote

I added the fortune command in /etc/profile to make it system-wide.
Back to top
View user's profile Send private message
SerfurJ
l33t
l33t


Joined: 10 Apr 2004
Posts: 824
Location: Texas

PostPosted: Mon Nov 15, 2004 9:02 pm    Post subject: Reply with quote

thanks, i was looking for how to do this. i put it in /etc/profile also.
Back to top
View user's profile Send private message
wjholden
l33t
l33t


Joined: 01 Mar 2004
Posts: 826
Location: Augusta, GA

PostPosted: Fri Apr 01, 2005 10:14 pm    Post subject: Reply with quote

Code:
fortune homer | cowsay
Put that in /etc/profile, heh heh!
Back to top
View user's profile Send private message
cweilema
n00b
n00b


Joined: 15 May 2004
Posts: 38

PostPosted: Fri Mar 31, 2006 4:44 pm    Post subject: Reply with quote

I've tried adding:

Code:
echo
fortune -a
echo


to both my ~/.bash_profile and /etc/profile with no success. The only way I've been able to have /etc/profile work is by doing:

Code:
source /etc/profile


in my ~/.bashrc file, but that broke scp.

Does anyone have any suggestions for what I might be doing wrong? I use xterm and I really enjoy fortunes showing up when I fire up a terminal. On a side note, I do have the above fortune code in the root portion of my /etc/profile and whenever I "su -" in xterm, a fortune will pop up.

I'm really confused. Any help would be appreciated.

TIA,
--
-Chris
Back to top
View user's profile Send private message
overkll
Veteran
Veteran


Joined: 21 Sep 2004
Posts: 1249
Location: Austin, Texas

PostPosted: Fri Mar 31, 2006 5:35 pm    Post subject: Reply with quote

I copied this info from a slackware install a couple of years ago when moving from slackware to Gentoo. I added it to the end of my .bashrc files.

Code:
# Print a fortune cookie for interactive shells:
if [[ $- = *i* ]]; then
  echo
  fortune -s
  echo
fi

scp still works fine.
Back to top
View user's profile Send private message
chunderbunny
Veteran
Veteran


Joined: 31 May 2004
Posts: 1281
Location: 51°24'27" N, 0°57'15" W

PostPosted: Fri Mar 31, 2006 9:18 pm    Post subject: Reply with quote

I have this in .bashrc (no idea where it came from). If you put it in as the first command then you can do whatever you like in .bashrc and not worry about breaking non-interactive stuff.

Code:
# If not running interactively, don't do anything
[ -z "$PS1" ] && return
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum