1

By configuring ~/.bashrc as desired, each time the user logs into their bash shell the configured settings (of .bashrc) will automatically be set. Now I must be missing something but despite thorough DuckDuckGo'ing I cannot figure out the equivalent for C-shell.

As a reference for bash-shell, there is a thorough explanation of configuring its default settings at the question: What is the .bashrc file?

For reference, I am using CentOS: (As you may have guessed, LINUX isn't my forte)

[user@computer ~]$ uname -r
2.6.32-504.12.2.el6.x86_64
[user@computer ~]$ lsb_release -a                                                                           
LSB Version:    :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: CentOS
Description:    CentOS release 6.6 (Final)
Release:        6.6
Codename:       Final

Many thanks for reading this.

-- Edit -- Fixed tags.

-- Edit 2 -- Meant to include that this is also a very good (related) question: What is the .bashrc file?

1

csh is really tcsh on almost all systems, including CentOS. From the tcsh manpage (tcsh(1)):

Startup and shutdown

A login shell begins by executing commands from the system files /etc/csh.cshrc and /etc/csh.login. It then executes 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. (+)

Non-login shells read only /etc/csh.cshrc and ~/.tcshrc or ~/.cshrc on startup.

[... rest of the section trimmed ...]

I personally like to just use ~/.tcshrc. If you want, you can "detect" a login shell like so:

setenv PATH /bin:/sbin/:...

if ( $?prompt ) then
    exit
endif

# This is only for interactive shells
set color
set printexitvalue
  • Thank you very much, creating and modifying ~/.tcshrc does the job. – PhilPhil Jul 23 '15 at 12:01
  • A side note regarding the manpage: On my system ~/.history contains the history of the commands that I've entered previously. So I doubt that modifying it would have the desired effect here. – PhilPhil Jul 23 '15 at 12:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.