Beginner question about chdir()

Beginner question about chdir()

Post by James Ian McGow » Fri, 01 Jan 1993 01:51:09



A beginner question:

How can i use the chdir() call in a program and have it affect
the current directory of the parent process?  Is there some
tricky way of telling the shell (csh in this case) to do a cd?

If this is a FAQ, i apologise.  Pointers to sources of
information about how a child process can affect the environment
of its parent would be very welcome.

Thanks
--

 
 
 

Beginner question about chdir()

Post by Christoph Badu » Tue, 05 Jan 1993 20:44:13



Quote:>How can i use the chdir() call in a program and have it affect
>the current directory of the parent process?

You can't. The parent process must execute a chdir(2) call itself.

Quote:>  Is there some
>tricky way of telling the shell (csh in this case) to do a cd?

You could tell the parent to the it's own chdir() but this requires
cooperation from the parent.

Quote:>If this is a FAQ, i apologise.  Pointers to sources of
>information about how a child process can affect the environment
>of its parent would be very welcome.

Look into the comp.unix.questions FAQ, it covers this topic at length.
--

AIX is a better... is a better...  is a better... OpenSystem.
                                        IBM Rep at GUUG Symposium '92

 
 
 

1. chdir()... or strcat() then chdir()

can anyone tell me which one would be better?

for ( i = 0; i < at least 1000 times; i++ ) {
        chdir() 4 times then reading of the dir content
        or,
        strcat() of the whole string of dir name,
        then chdir().

thanks in advance.

----------------|

----------------|

2. How can one avoid sending mail after an `at' ?

3. Beginners: Here's the beginners web info you've been looking for

4. Use if S_IFMT and S_IFDIR

5. beginner fork question

6. SoundCard AUDIO EXCEL FM801 PCI

7. Beginner's network question

8. Kernel PPP support

9. Getting online : beginner question...

10. Beginner's Questions

11. Beginner question..pls help

12. some beginner questions

13. ? beginner question