Calling source from a tcsh shell script - Unix

This is a discussion on Calling source from a tcsh shell script - Unix ; If I execute the following program: -------------------------- #!/bin/tcsh -f source setmyenv.cshrc nbq $target_bin --------------------- where setmyenv.cshrc contains: setenv TESTPATH ../../xxx setenv TESTNAME test1 and nbq is a netbatch command which submits the jobs $target_bin to netbatch pool. When I do ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: Calling source from a tcsh shell script

  1. Calling source from a tcsh shell script

    If I execute the following program:
    --------------------------
    #!/bin/tcsh -f

    source setmyenv.cshrc
    nbq $target_bin
    ---------------------
    where setmyenv.cshrc contains:
    setenv TESTPATH ../../xxx
    setenv TESTNAME test1

    and nbq is a netbatch command which submits the jobs $target_bin to
    netbatch pool.

    When I do this, the $target_bin is not able to see the environment
    variables TESTPATH and TESTNAME.

    On the other hand, If do the following it works:

    volt@snoopy>> source setmyenv.cshrc
    volt@snoopy>> nbq $target_bin

    Now $target_bin is able to see TESTPATH and TESTNAME.

    Any ideas of what I am doing wrong in the previous case?


  2. Re: Calling source from a tcsh shell script

    I'm not familiar with nbq, but you might want to test if the
    environment is getting set before
    it's invoked, and check if it passes on the environment information.
    In your example, e.g.:
    #!/bin/tcsh -f
    source setmyenv.cshrc
    nbq $target_bin
    You could test (such as with env(1)) between the source setmyenv.cshrc
    and nbq $target_bin
    lines to see what's set in your environment. Likewise you could modify
    $target_bin to test
    and report on its environment. It is quite possible that nbq may
    filter, sanitize, or reinitialize the environment.


+ Reply to Thread