Ask a Question related to Linux / Unix Administration, Design and Development.
-
Angel de Vicente #1
How to get info on which files are being loaded (and in which order) when I do source .cshrc?
Hi all,
I use tcsh and have a .cshrc file that loads other file, this one another one,
with conditions, etc. I would like to have an easy way of loading the file, and
at the same time telling me which files are being loaded (I don't have write
permission in all those files, so modifying them is not an option).
I was trying yesterday a way to do this and I came up with a way that "seems" to
work, but I don't understand why! (Actually I think it should not work). I
create a file "source-mine" with the following:
----------------------
#!/bin/tcsh
echo "Loading file $1"
/bin/tcsh -c "alias source /home/angelv/SCRIPTS/source-mine ; source $1"
----------------------------------
Then I make an alias
alias source source-mine
And load the file
source .cshrc
I seem to get the correct behaviour, but why does it work? I get the following:
[angelv@guinda Perl-Expect]$ source ~/.cshrc
Loading file /home/angelv/.cshrc
Loading file /usr/glob/user/.cshrc
Loading file /usr/glob/user/SIE/.cshrc_SIE
[angelv@guinda Perl-Expect]$
I understande the first line ("Loading file /home/angelv/.cshrc"), after all I'm
doing the echo line, regardless of whether the file will be actually sourced or
not, but what I don't understand is why the file gets actually sourced (and
loads the files /usr/glob/user/.cshrc and /usr/glob/user/SIE/.cshrc_SIE), since
in the line
/bin/tcsh -c "alias source /home/angelv/SCRIPTS/source-mine ; source $1"
I'm aliasing the source command again, so I would expect that source $1 would
actually just execute this script again and I should get recursively:
[angelv@guinda Perl-Expect]$ source ~/.cshrc
Loading file /home/angelv/.cshrc
Loading file /home/angelv/.cshrc
Loading file /home/angelv/.cshrc
Loading file /home/angelv/.cshrc
[...]
Obviously I don't want this, and I'm happy with getting the observed behaviour,
but I don't understand why it works.
Any ideas?
Thanks a lot,
Angel de Vicente
--
----------------------------------
[url]http://www.iac.es/galeria/angelv/[/url]
PostDoc Software Support
Instituto de Astrofisica de Canarias
Angel de Vicente Guest
-
#25094 [Opn->Bgs]: rename() function caches a source file info
ID: 25094 Updated by: iliaa@php.net Reported By: naumovic at beotel dot yu -Status: Open +Status: ... -
#25094 [NEW]: rename() function caches a source file info
From: naumovic at beotel dot yu Operating system: Win 2000 PHP version: 4.3.2 PHP Bug Type: Filesystem function related Bug... -
Re : Order ide drivers are loaded?
On Tue, 05 Aug 2003 03:22:48 +0200 Siward <siward.via@freeler.nl> wrote: Not long ago I had a similar situation, and here are the work notes... -
Order ide drivers are loaded?
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hallo! A friend's computer has a Gigabyte GA-7VAXP-A Ultra motherboard. This mobo has the... -
Choosing in what order programs are loaded
"Mats" <matzas@spray.se> wrote: Write a batch file that starts the applications. You can use the START command in the batch file for better... -
Unregistered #2
Re: How to get info on which files are being loaded (and in which order) when I do so
you call a new shell here
/bin/tcsh -c "alias source /home/angelv/SCRIPTS/source-mine ; source $1"
this will not create new alias at the level of the script, it will create it in the new shell, but it will exit immediately an the alias will be lost.Unregistered Guest



Reply With Quote

