How to get info on which files are being loaded (and in which order) when I do source .cshrc?

Ask a Question related to Linux / Unix Administration, Design and Development.

  1. #1

    Default 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

  2. Similar Questions and Discussions

    1. #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: ...
    2. #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...
    3. 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...
    4. 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...
    5. 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...
  3. #2

    Default 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

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139