![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| UNIX for Advanced & Expert Users Advanced UNIX and Linux questions go here. Expert-to-Expert. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Can a child process return a specific value to a parent process ? | Ametis1970 | High Level Programming | 8 | 04-09-2008 08:22 PM |
| Testing the forking process. | Vitamin254 | UNIX for Dummies Questions & Answers | 0 | 02-22-2008 08:12 PM |
| forking process. | kymthasneem | High Level Programming | 2 | 06-23-2007 10:00 AM |
| forking a new process | themezzaman | High Level Programming | 4 | 06-20-2006 01:13 AM |
| KDM child process | larryase | UNIX for Dummies Questions & Answers | 6 | 01-24-2005 02:41 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
hi,
I thought that when a child shell is forked, it will inherit all the variables of the parent now in my .cshrc I have Code:
setenv X x Code:
setenv X y I then have a very simple script, y.csh Code:
#!/usr/bin/csh echo X Code:
%: y.csh thanks. |
| Forum Sponsor | ||
|
|
|
#2
|
|||
|
|||
|
Works as expected for me
Code:
%setenv X x %echo $X x %setenv X y %echo $X y %cat t #!/usr/bin/csh echo $X %./t y % |
|
#3
|
|||
|
|||
|
no, I think you missed the bit that my .cshrc also sets X (to x)
thanks |
|
#4
|
|||
|
|||
|
Quote:
going through your "y.sh", you gave "echo X" - which will print "X" if you want to print value in variable X, you should have given "echo $X" |
|
#5
|
|||
|
|||
|
Unless it is a requirement, consider using a shell that does not have the problems csh has.
Here is an article, feel free to disagree: into the wibble [csh is bad] |
|
#6
|
|||
|
|||
|
sorry, I DO have echo $X.
Code:
#!/usr/bin/csh echo $X 1) .cshrc sets X to x 2) I setenv X y in my shell 3) I then do y.csh Now I know .cshrc will be called everytime a csh script is called. And obviously in this script we;re setting X to x. But I also thought that the child shell will inherit all the parents variables. So I would have expected it to inherit X = y, and for this to overrride whatever is happening in the .cshrc! thanks. |
|
#7
|
|||
|
|||
|
Please do a "man csh"
-f Suppress execution of the .cshrc file change your script from: Code:
#!/usr/bin/csh echo $X Code:
#!/usr/bin/csh -f echo $X |
|||
| Google The UNIX and Linux Forums |