Proper Way To Run Fortune


Recommended Posts

what is the proper way to run fortune. I currently have the fortune command at the bottom of my .bashrc file. It seems to work well, but I read this warning in my .bashrc

# /etc/skel/.bashrc:
# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/skel/.bashrc,v 1.8 2003/02/28  15:45:35 azarah Exp $

# 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.

so i am guessing since fortune produces output, this could cause problems. I know slackware uses forture, I wonder what method that distro uses.

Link to post
Share on other sites

I am not sure where to put it one my gentoo system. If I use /etc/profile, it does not seemed to get sourced the first time I open a shell, when I first open an xterm fortune does not run. But if I change to user of root using '-' , like su - shane, then fortune runs. I hardly use scp, so maybe I will just leave it in my .bashrc

Link to post
Share on other sites
RTFM :)

oxymoron above :-)

cool, I never used the info command before. I fond this

6.3.2 Is this Shell Interactive?
--------------------------------

To determine within a startup script whether or not Bash is running
interactively, test the value of the `-' special parameter.  It
contains `i' when the shell is interactive.  For example:

    case "$-" in
    *i*)       echo This shell is interactive;;
    *) echo This shell is not interactive;;
    esac

it just is

Link to post
Share on other sites

The parameter - contains the option flags that are set in the shell. 'i' corresponds to the option '-i', which starts an interactive shell. A partial list of flags can be found in the documentation for the 'set' builtin in the bash manpage. ('himBH' = history enabled, interactive, monitor mode (nicer interactive job control), brace expansion, '!' history substitution.)

I can't believe you had never used info :) It's the primary documentation for the GNU project; the half-assed manpages are secondary (at best) to the texinfo docs. It's one of the GNU project's more irritating quirks.

Edited by jcl
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...