The reason you cannot "permanently change" the cwd is that linux is using proper job management. When bash spawns a child process, it inherits the parent's environment, but a copy of it. Therefore, your cwd will impact child processes but the children cannot affect the parent.
What I'm not understanding is why you want to mash some graphical directory browser into the command line. You can, however, do something like this: 1) Write your application 2) have it print out the directory to stdout when it exits 3) write a wrapper script to run your program, like this: # filename=programNameWrapper cd "$(programName)" 4) write an alias line in your ~/.bashrc, like this: alias programName="source programNameWrapper" 5) every time you type programName at the prompt, you will change directories to whatever it prints out at the end. On Tue, Aug 25, 2009 at 11:43 AM, Dos-Man 64 <[email protected]> wrote: > > > > On Aug 25, 11:38 am, Dos-Man 64 <[email protected]> wrote: > > On Aug 25, 11:13 am, Robert Citek <[email protected]> wrote: > > > > > On Tue, Aug 25, 2009 at 9:34 AM, Dos-Man 64<[email protected]> wrote: > > > > That's an interesting trick actually. However, the results that it > > > > spits out often don't match the output of the ls command. > > > > > Right. Since it doesn't make sense to cd into a file or socket or > > > pipe, bash only displays folders for cd command completion. If you > > > want all files use ls. If you want environment variables use echo $. > > > If you want to cd to user's folder, use cd ~. In short, command > > > completion on most modern distros is context-dependent. > > > > > Regards, > > > - Robert > > > > But isn't it possible for a program to permanently change the current > > working directory? Then I can just write my own utility. > > > > For example, using free pascal and creating a form with a directory > > listbox on it. Then use > > > > Chdir(DirectoryEdit1.Directory); > > > > I tried this and when the program ended, the current working directory > > was not changed. Seems kind of arrogant of the shell not to allow the > > application to change the current working directory. Windows console > > apps have the same problem. The only workaround is to use a 16-bit MS- > > DOS application (which don't do long file names and are anti-gui to > > begin with). > > > Wait, I have an idea. Maybe I can have my application navigate to the > specified directory and then copy the directory to the clipboard. > Well, it's not a clean solution, but it's better than nothing. > > > -- Daniel --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Linux Users Group. To post a message, send email to [email protected] To unsubscribe, send email to [email protected] For more options, visit our group at http://groups.google.com/group/linuxusersgroup -~----------~----~----~----~------~----~------~--~---
