Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Q on csh script - setenv ROOT_PATH

Status
Not open for further replies.

no_mad

Full Member level 5
Joined
Dec 10, 2004
Messages
271
Helped
30
Reputation
60
Reaction score
11
Trophy points
1,298
Location
Naboo
Activity points
2,489
Q on csh script

Hi,

Here is my simple script:

Code:
#! /bin/csh -f
setenv ROOT_PATH `pwd`

Result:
It failed at setenv.
When I did echo $ROOT_PATH, it said ROOT_PATH: Undefined variable.

Please advice.
Thanks in advance.
 

Re: Q on csh script

in my c shell , it works , the echo result is "pwd"!
 

Re: Q on csh script

Hi,
You could use "set ROOT_VAR=`pwd`" expression if you do not need to inherit $ROOT_VAR variable to child shell and deeper
 

Re: Q on csh script

Hi,

Thanks for all the replies.

I have found the culprit.
It got nothing to do with setenv.

The problem is I'm trying to execute a tcsh file in csh.
Is it possible to do that? I'm just a beginner in c shell scripting.

Code:
#! /bin/csh -f
 
/proc/bin/setproj    #tcsh script file

cd my_proj
setenv ROOT_PATH `pwd`
source $ROOT_PATH/my_tools/proj.env

Any ideas.
Thanks
 

Re: Q on csh script

Hi,
Yes, sure you can run tcsh script in csh script. Just make sure "tcsh" script is "executable" OR you can use following statment to run "nonexecutable" script:
#! /bin/csh -f

tcsh /proc/bin/setproj #tcsh script file

cd my_proj
setenv ROOT_PATH `pwd`
source $ROOT_PATH/my_tools/proj.env
 

Re: Q on csh script

Hi kulyapinav,

Thanks for ur reply.

I tried and now it can execute.
But the problem is it dont proceed to the next statement in my csh file.
Until I type 'exit'.

After debug, i found out that the tcsh file checking for exit command.
Example:
Code:
if ($status == 0) then
                  do_this1
                  do_next
else
                  exit 1;
endif

Please help me out here.

Thanks
 

Re: Q on csh script

Hi,
I am not able to reproduce the issue. Please, provide both scripts extended example
 

Re: Q on csh script

my main script:
Code:
#! /bin/csh -f

tcsh /proc/bin/setproj -p myproj -cfg U2 #tcsh script file

cd my_proj_path
setenv ROOT_PATH `pwd`
source $ROOT_PATH/my_tools/proj.env

here is the tcsh script called setproj:
Code:
#!/usr/bin/tcsh -f
      setenv MOUNTS /dir1/proj1
      setenv SETPROJ "$MOUNTS/proc/bin/setproj $argv"
       
      set cmd =  `$MOUNTS/proc/bin/setproj.pl $argv`
      if ( $status == 0 ) then
              eval "$cmd";
              set path = ($MOUNTS/proc/bin $path)
              source $MOUNTS/proc/bin/temp.csh
     else
              exit 1;
     endif
 

Re: Q on csh script

Hi,
Your script looks fine and it works from my side.
Try paste here the error message that you see
 

Re: Q on csh script

Hi kulyapinav,

Thanks for ur fast response.

It is working.
There is no error has been generated.
The problem is after it executed setproj script, it didnt execute the next statement in main script. Until i typed exit.

main script:
Code:
#! /bin/csh -f

tcsh /proc/bin/setproj -p myproj -cfg U2 #tcsh script file

cd my_proj_path                                  #it will execute if I type 'exit'
setenv ROOT_PATH `pwd`
source $ROOT_PATH/my_tools/proj.env
 

Re: Q on csh script

Hi,
I see. It looks like the perl script is waiting for some STD INPUT
Pay attention that you try to evaluate the perl script result. I suppose that process would like user to type something, to say another words it wait for response from input stream STDIN. Debug this part of code to be sure that nothing needed to suspend the execution on script.

To do more correct advice provide me "echo $cmd" result.
 

    no_mad

    Points: 2
    Helpful Answer Positive Rating
Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top