LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (http://www.linuxquestions.org/questions/slackware-14/)
-   -   Strange bug with csh. (http://www.linuxquestions.org/questions/slackware-14/strange-bug-with-csh-4175431080/)

Lockywolf 10-08-2012 04: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:

Code:

locky@netbook:~% su locky
Пароль:

Boy, that crayon sure did hurt!

locky@netbook:~>

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 11:38 AM

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
Code:

if ($?prompt) then
endif

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

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

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 :)

John

Lockywolf 10-09-2012 03:09 AM

Quote:

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

Code:

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

if ( { tty --silent } ) then >& /dev/null
  echo "" ; fortune fortunes fortunes2 linuxcookie ; echo ""
endif
locky@netbook:~>
locky@netbook:~> /etc/profile.d/bsd-games-login-fortune.sh
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.

locky@netbook:~>



All times are GMT -5. The time now is 03:41 PM.