Striker8118
Weaksauce
- Joined
- Jul 31, 2003
- Messages
- 75
I am currently working on this unix shell project...
I am really confused on how some the whole system of how to set the PWD variable. I am changing the current working directory by using the call chdir(argument). That works out just fine. I know that the chdir handles all of that stuff for me. My question is, when I do that chdir and I go into a subfolder. Say I am in /home/cs442/project2/ and then i go into a subfolder temp by using chdir. When I output the PWD variable by using getenv("PWD") it is supposed to output my current working directory. How do i set this pwd after using the chdir() call. I know i can do it for simple changes such as cd temp or cd .. but what about more complex calls such as:
cd ../temp/1/../../../../foo/bar
I am unsure of how to handle these types of calls
If anyone has any shell experience and would like to lend a hand, feel free.
Thanks in advance to anyone who helps
Bobby Thompson
I am really confused on how some the whole system of how to set the PWD variable. I am changing the current working directory by using the call chdir(argument). That works out just fine. I know that the chdir handles all of that stuff for me. My question is, when I do that chdir and I go into a subfolder. Say I am in /home/cs442/project2/ and then i go into a subfolder temp by using chdir. When I output the PWD variable by using getenv("PWD") it is supposed to output my current working directory. How do i set this pwd after using the chdir() call. I know i can do it for simple changes such as cd temp or cd .. but what about more complex calls such as:
cd ../temp/1/../../../../foo/bar
I am unsure of how to handle these types of calls
If anyone has any shell experience and would like to lend a hand, feel free.
Thanks in advance to anyone who helps
Bobby Thompson