Problem with hostname

Hello!
My name is Steve and I've got a stupid problem with my FreeBSD that I can't resolve by myself (it makes me become mad). My problem is that I can't view my current hostname anymore but I didn't touch anything, but what do I view? Just a %. I'm going to show you now my configured files:

/etc/rc.conf

Code:
defaultrouter="192.168.2.1"
hostname="tff.game-server.cc"
ifconfig_em0="inet 192.168.2.2  netmask 255.255.255.0"
moused_enable="YES"
mysql_enable="YES"
sshd_enable="YES"

/etc/hosts

Code:
::1			localhost localhost.game-server.cc
127.0.0.1		localhost localhost.game-server.cc
192.168.2.2		tff.game-server.cc tff

/root/.cshrc

Code:
alias h		history 25
alias j		jobs -l
alias la	ls -a
alias lf	ls -FA
alias ll	ls -lA

# A righteous umask
umask 22

set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin $HOME/bin)

setenv	EDITOR	vi
setenv	PAGER	more
setenv	BLOCKSIZE	K

if ($?prompt) then
	# An interactive shell -- set some stuff up
	set prompt = "`/bin/hostname -s`# "
	set filec
	set history = 100
	set savehist = 100
	set mail = (/var/mail/$USER)
	if ( $?tcsh ) then
		bindkey "^W" backward-delete-word
		bindkey -k up history-search-backward
		bindkey -k down history-search-forward
	endif
endif

When I type hostname on the shell, I get this reply:

Code:
tff.game-server.cc

Just a snapshot to make you understand my problem:

FmwL
 
See the man page for csh(1). The %M and %m variables can be used instead of running hostname(1) for every prompt.
Code:
set prompt = "%M # "

Why that's not displaying is another question. If that is set only in /root/.cshrc, other users will not see it. Everyone has their own .cshrc.
 
wblock@ said:
See the man page for csh(1). The %M and %m variables can be used instead of running hostname(1) for every prompt.
Code:
set prompt = "%M # "

Why that's not displaying is another question. If that is set only in /root/.cshrc, other users will not see it. Everyone has their own .cshrc.

It didn't work.
 
I think that the problem isn't in the .cshrc file (just because the other users is displayed otherwise hostname).
 
wblock@ said:
Whoa, too many details, slow down.

Seriously, give us something to work with. What happened, exactly?

I just typed chsh root for a quick edit of main directory and then a reboot now.
 
Why are you running chsh(1)? Why reboot? To see a prompt change, just log out and log back in.

Still not able to tell what is happening. What did it show? What is the output of
% hostname
 
I typed a reboot now because I couldn't see my hostname anymore after logout, however if you go up (in first post) you can read the part of hostname command.
 
I couldn't fix it (I was getting too boring), so I decided to mount a backup of my OS. Thanks for your helps, now you may as well close.
 
Sorry if I'm triple-posting but I can give you an easy fix if you got my same problem. Just edit /etc/csh.cshrc, adding:

Code:
alias h		history 25
alias j		jobs -l
alias la	ls -a
alias lf	ls -FA
alias ll	ls -lA

# A righteous umask
umask 22

set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin /usr/local/bin $HOME/bin)

setenv	EDITOR	vi
setenv	PAGER	more
setenv	BLOCKSIZE	K

if ($?prompt) then
	# An interactive shell -- set some stuff up
	set prompt = "`/bin/hostname -s`# " #You can add there what you want if you don't like your registered hostname
	set filec
	set history = 100
	set savehist = 100
	set mail = (/var/mail/$USER)
	if ( $?tcsh ) then
		bindkey "^W" backward-delete-word
		bindkey -k up history-search-backward
		bindkey -k down history-search-forward
	endif
endif
 
In post #2, I said "Everyone has their own .cshrc." What you're doing there is editing the system-wide default. Every user will get that file, instead of being able to use their own. One problem is that you have it displaying a # prompt, regardless of user. Traditionally, a # prompt lets you see you are logged in as root.

Again, running hostname(1) every time a prompt is displayed can be avoided by using the existing variables.
 
A better alternative to:

Code:
set prompt = "`/bin/hostname -s`# " #You can add there what you want if you don't like your registered hostname

might be:

Code:
set prompt = "%m%# "

%m is the hostname up to the first '.', and %# is the appropriate prompt character for normal users or the superuser.

The Dreamer.
 
Back
Top