Solved

.cshrc files

Posted on 1998-01-05
2
442 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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
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…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

770 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