Subject: misc/4248: /.cshrc should distinguish non-root login, and give appropriate prompt
To: None <gnats-bugs@gnats.netbsd.org>
From: the Riz <riz@beast.boogers.sf.ca.us>
List: netbsd-bugs
Date: 10/09/1997 11:14:08
>Number:         4248
>Category:       misc
>Synopsis:       root .cshrc should provide non-# prompt when non-root login
>Confidential:   yes
>Severity:       non-critical
>Priority:       low
>Responsible:    misc-bug-people (Misc Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Thu Oct  9 11:20:02 1997
>Last-Modified:
>Originator:     
>Organization:
>Release:        23 September 1997
>Environment:

System: NetBSD beast.boogers.sf.ca.us 1.2E NetBSD 1.2E (BEAST) #4: Sun Sep 7 11:10:40 PDT 1997 riz@beast.boogers.sf.ca.us:/usr/src/sys/arch/i386/compile/BEAST i386


>Description:

When a non-root user has "/" as a home directory, the default .cshrc files
give the user a prompt with '#' in it.  This causes some confusion.  Users
who are not root should have '%' in place of '#'.  

>How-To-Repeat:

Have a user's home directory not available for some reason, and their shell
set to csh (or tcsh).  Log in.  The prompt will be "hostname# ", where
hostname is the short name of the host being logged into.

>Fix:

Here's a diff from the current root .cshrc:



*** /.cshrc	Mon Sep 22 14:33:39 1997
--- .cshrc	Thu Oct  9 10:56:02 1997
***************
*** 23,29 ****
  alias	tset	'set noglob histchars=""; eval `\tset -s \!*`; unset noglob histchars'
  
  if ($?prompt) then
! 	set prompt="`hostname -s`# "
  endif
  
  umask 022
--- 23,33 ----
  alias	tset	'set noglob histchars=""; eval `\tset -s \!*`; unset noglob histchars'
  
  if ($?prompt) then
! 	if (`/usr/bin/id -u` == 0) then
! 		set prompt="`hostname -s`# "
! 	else
! 		set prompt="`hostname -s`% "
! 	endif
  endif
  
  umask 022
>Audit-Trail:
>Unformatted: