Solved

.cshrc files

Posted on 1998-01-05
2
438 Views
Last Modified: 2013-12-16
Hi,
I am running a tcsh on solaris 2.5, i have a .cshrc and .cshrc2 file in my home directory, in the .cshrc file I have a entry "source .cshrc2" in the .cshrc2 file, there are lots of aliases.  When i su to root which is running a csh, the only way I can use the aliases as root is to go into my home directory and type " source .cshrc2" which is kinda annoying!
Does anybody know how i can get root to read the .cshrc2 file when i su ? I dont really want to change the type of shell root runs.

Cheers :)
0
Comment
Question by:ianfoster
2 Comments
 
LVL 51

Accepted Solution

by:
ahoffmann earned 50 total points
ID: 1812847
Several ways:
1. ln -s user_home_dir/.cshrc root_home_dir/.cshrc
2. add .cshrc to /etc/csh.cshrc
3. source .cshrc2 in /etc/csh.cshrc

But always keep in mind (or read csh man-page) that csh is a bit
strange when reading its resource files: .cshrc and .login . May be it's better to do some of your hacking from .cshrc in an other
file processed during csh startup (like .login).
0
 
LVL 1

Expert Comment

by:vancleef
ID: 1812848
Another way is to create an alias for root that can be used to
source your file.  That way other root users will not be confused
by your aliases.  I recommend keeping root's defaults very
simple, to allow easy logins during troubled times.

An alternative is to created a second root account "root2" with
a separate home directory that has everything that you want in
the way of aliases.  That way the primary account, root, can be
left with the borne shell, a short path, and minimal aliases.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now