LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-28-2011, 12:45 PM   #1
nasridine
Member
 
Registered: Jan 2010
Posts: 52

Rep: Reputation: 15
Can't change shell to cshell


I was trying to change my shell from bash to csh by typing "csh" and got this error "if: Empty if." I figured it is because if and then do show up in the same line in the cshell source file. However there is no .cshrc in my home directory. I looked at the /etc/csh.cshrc and everything seems correct. No "empty if". Any suggestions?
 
Old 02-28-2011, 12:54 PM   #2
xeleema
Member
 
Registered: Aug 2005
Location: D.i.t.h.o, Texas
Distribution: Slackware 13.x, rhel3/5, Solaris 8-10(sparc), HP-UX 11.x (pa-risc)
Posts: 987
Blog Entries: 4

Rep: Reputation: 252Reputation: 252Reputation: 252
Greetingz!

I'm going to have a lil fun with this, so please forgive me

/me dons my best Drill Instructor voice
Everybody repeat after me: "This is my man command. There are many like it, but this one is important. I must read the man page before posting, or my post will show my noobies."

From "man csh"
Code:
       A login shell begins by executing commands from the system files /etc/csh.cshrc and /etc/csh.login.  It then exe-
       cutes commands from files in the user’s home directory: first ~/.tcshrc  (+)  or,  if  ~/.tcshrc  is  not  found,
       ~/.cshrc,  then  ~/.history  (or the value of the histfile shell variable), then ~/.login, and finally ~/.cshdirs
       (or the value of the dirsfile shell variable) (+).  The shell may read /etc/csh.login  before  instead  of  after
       /etc/csh.cshrc,  and  ~/.login  before instead of after ~/.tcshrc or ~/.cshrc and ~/.history, if so compiled; see
       the version shell variable. (+)
Check to see if the two files highlighted above exist on your system, and see what they contain.

Last edited by xeleema; 02-28-2011 at 12:56 PM.
 
Old 02-28-2011, 01:18 PM   #3
nasridine
Member
 
Registered: Jan 2010
Posts: 52

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by xeleema View Post
Greetingz!

I'm going to have a lil fun with this, so please forgive me

/me dons my best Drill Instructor voice
Everybody repeat after me: "This is my man command. There are many like it, but this one is important. I must read the man page before posting, or my post will show my noobies."

From "man csh"
Code:
       A login shell begins by executing commands from the system files /etc/csh.cshrc and /etc/csh.login.  It then exe-
       cutes commands from files in the userís home directory: first ~/.tcshrc  (+)  or,  if  ~/.tcshrc  is  not  found,
       ~/.cshrc,  then  ~/.history  (or the value of the histfile shell variable), then ~/.login, and finally ~/.cshdirs
       (or the value of the dirsfile shell variable) (+).  The shell may read /etc/csh.login  before  instead  of  after
       /etc/csh.cshrc,  and  ~/.login  before instead of after ~/.tcshrc or ~/.cshrc and ~/.history, if so compiled; see
       the version shell variable. (+)
Check to see if the two files highlighted above exist on your system, and see what they contain.
Only two of the files you mentioned exist in my system. /etc/csh.cshrc and /etc/csh.login. It seems to me all the if-then's are in the same line.
Attached is the content of the two files. I never used csh on this machine, so I don't think these files have ever been touched.
/etc/csh.login
Code:
# /etc/cshrc
#
# csh configuration for all shell invocations.

# By default, we want this to get set.
# Even for non-interactive, non-login shells.
if ($uid > 99 && "`id -gn`" == "`id -un`") then
    umask 002
else
    umask 022
endif

if ($?prompt) then
  if ($?tcsh) then
    set promptchars='$#'
    set prompt=\[$user'@%m %c]%# ' 
  else
    set prompt=\[$user@`hostname -s`\]\$\ 
  endif
endif

if ( $?tcsh ) then
        bindkey "^[[3~" delete-char
endif

bindkey "^R" i-search-back
set echo_style = both
set histdup = erase
set savehist = (1024 merge)
setenv MAIL "/var/spool/mail/$USER"
limit coredumpsize 0

# Check if we aren't a loginshell and do stuff if we aren't
if (! $?loginsh) then
    if ( -d /etc/profile.d ) then
        set nonomatch
        foreach i ( /etc/profile.d/*.csh )
            if ( -r $i ) then
                if ($?prompt) then
                    source $i
                else
                    source $i >&/dev/null
                endif
            endif
        end
        unset i nonomatch
    endif
endif
/etc/csh.login
Code:
# /etc/csh.login

# System wide environment and startup programs, for login setup

if ($?PATH) then
        if ( "${path}" !~ */usr/X11R6/bin* ) then
                setenv PATH "${PATH}:/usr/X11R6/bin"
        endif
else
        if ( $uid == 0 ) then
                setenv PATH "/sbin:/usr/sbin:/usr/local/sbin:/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin"
        else
                setenv PATH "/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin"
        endif
endif

setenv HOSTNAME `/bin/hostname`
set history=1000

if ( ! -f $HOME/.inputrc ) then
        setenv INPUTRC /etc/inputrc
endif

if ( -d /etc/profile.d ) then
        set nonomatch
        foreach i ( /etc/profile.d/*.csh )
                if ( -r $i ) then
                                if ($?prompt) then
                                      source $i
                                else
                                      source $i >& /dev/null
                                endif
                endif
        end
        unset i nonomatch
endif


# Set umask consistently with bash for loginshells (csh.login sourced
# after csh.cshrc unlike with bash profile/bashrc scripts and umask
# might be modified in profile.d csh scripts)
if ($?loginsh) then
  if ($uid > 99 && "`id -gn`" == "`id -un`") then
      umask 002
  else
      umask 022
  endif
endif
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
how do i install cshell on linux smeezekitty Linux - Newbie 12 10-20-2009 01:43 AM
obfuscator for cshell. DoME69 Programming 1 07-02-2008 07:23 AM
Where is good old cshell? Ken882 Linux - Newbie 4 04-13-2007 08:54 AM
[cshell] awk help! saiz66 Programming 3 09-28-2004 06:55 PM
Cshell querying two files... HiOctane21 Programming 1 05-01-2004 07:19 PM


All times are GMT -5. The time now is 09:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration