views:

130

answers:

2

I've written a built-in for bash which modifies the 'cd' command, a requirement for my software. Is there a way to actually distribute a loadable independently of bash itself? I'd ideally like to distribute just a drop in "additional feature" because I know people can be put off by patching and compiling their shell from source code.

+1  A: 

Modifying the built-in cd command sounds like a very bad idea. Why do you think you need to do it? What have you changed, and why? Why is your software unique in requiring this change when no-one else has needed to do it?

AFAIK, bash does not support loadable modules. Judging from the lack of prior response (4 hours of silence), no-one else does either.

Jonathan Leffler
I want to time how long a user is in a directory so I can determine where they want to be. It's this functionality:http://github.com/joelthelion/autojump/tree/masterrewritten as a bash builtin, for perfo. issues. This implementation uses $PROMPT_COMMAND to work but I wanted something integrated.
Philluminati
A: 

Changing the built-in cd is a support nightmare for any admin and unwelcome to foreign users. What is wrong with naming it 'smart-cd' and letting the USER decide if they want the functionality by including it in their .bashrc or .profile? Then they can setup things however they want.

Also, using how long you've been in a directory is a pretty poor indication of preference. How would you distinguish between idling (a forgotten shell hanging in /tmp overnight), long-running scripts (nightly cron jobs), and actual activity.

There are a multitude of other methods for creating shortcuts to favorite directories: aliases, softlinks, $VARIABLES, scripts. It is arrogant of you to assume that your usage patterns will be welcomed by other users of your system.

HUAGHAGUAH
http://www.reddit.com/r/programming/comments/7y4ap/where_the_fuck_has_this_been_for_the_last_30/The 340 people who voted this thread up obviously didn't think so. I never said that time spent in a directory was a good sole indicator just a helping factor.You're the arrogant one
Philluminati