how to change parent environment?

paul.d.finkel pfinkel at cbnewsb.cb.att.com
Wed May 15 02:10:37 AEST 1991


In article <1991May2.194624.21819 at kong.gsfc.nasa.gov> njacobs at kong.gsfc.nasa.gov (Nick Jacobs - EOS) writes:
>How do you change the current working directory in a program, so
>that when the program is invoked from a shell, the cwd stays
>changed after the program exits?
>You can't do it with chdir(2) of course, because that only affects
>the current process.
>
>Nick

 You could run it from a shell function:

	$pwd    
	/usr/bin
	$go_go()
	{
	cd /etc
	your_command
	pwd
	}
	$go_go
	/etc
	$pwd
	/etc



More information about the Comp.unix.programmer mailing list