-   Slackware (
-   -   Strange bug with csh. (

Lockywolf 10-08-2012 05:50 AM

Strange bug with csh.
I use tcsh as my shell.

The strange thing is that /etc/profile.d/bsd-games-login-fortune.csh gets executed for all shells, not just login ones.

I mean, when i run "su" I get a fortune:


locky@netbook:~% su locky

Boy, that crayon sure did hurt!


This leads to an even more strange consequence:
I cannot run "less" command as for every file it shows less'ed fortune text. (different each time).

As a temporary workaround, I chmodded -x /etc/profile.d/bsd-games-login-fortune.csh, but it seems like a bug in Slackware.

jmccue 10-08-2012 12:38 PM

None of that happens for me, I would check out your ~/.login and ~/.tcsrc. Things to consider:
Are you starting tcsh as `tcsh -l` ?
'su' to root keeps you in /bin/tcsh ?
Does this happen when executing a script ?
Are commands you do not want to run except when logging in bracketed by

if ($?prompt) then

I noticed a very minor issue with /etc/csh.login, this line:

set path = ( $path /usr/games )
can cause duplicate entries to show up in $path, depending upon what you are doing. I changed it to

set path = ( /usr/local/bin /bin /usr/games )
in order to correct the issue. At one time in a prior release /etc/csh.login was changed to prevent dups, I think the change was different than above. I am planning to search for that change but been lazy so far :)


Lockywolf 10-09-2012 04:09 AM


Are commands you do not want to run except when logging in bracketed by
that's not me:-) it is Slackware


locky@netbook:~> cat /etc/profile.d/bsd-games-login-fortune.csh
# Print a fortune cookie for login shells:

if ( { tty --silent } ) then >& /dev/null
  echo "" ; fortune fortunes fortunes2 linuxcookie ; echo ""
locky@netbook:~> /etc/profile.d/
locky@netbook:~> /etc/profile.d/bsd-games-login-fortune.csh

Accidents cause History.

If Sigismund Unbuckle had taken a walk in 1426 and met Wat Tyler, the
Peasant's Revolt would never have happened and the motor car would not
have been invented until 2026, which would have meant that all the oil
could have been used for lamps, thus saving the electric light bulb and
the whale, and nobody would have caught Moby Dick or Billy Budd.
                -- Mike Harding, "The Armchair Anarchist's Almanac"

I hear what you're saying but I just don't care.


All times are GMT -5. The time now is 06:56 AM.