Skip to content

How it took me 20 hours to learn process isolation

github.com/danobi
2 pointsdanobi2 comments
On HN

Comments

How many times have you done "ls; cd <xx>; cd ..; ls; cd <yy>; etc"? With that tedium in mind, I set out to create a simple ncurses utility to combine ls and cd. As luck would have it, actually implementing the directory changing functionality was done last. I guess I have to chalk this one up to experience.

You could make it work, if you think about the problem a bit differently. Have your program output a command, like "cd /your/dir", when it exits. Then run it with eval from the shell (assuming a bash shell.)

eval $(yourprogram)

... now, set up an alias: alias something='eval $(yourprogram)'

and there you go. "something" can now change your directory (and do anything else by echoing a command.)

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.