Is there a way in unix/linux to execute a command when you cd to it?
I am thinking of something like
- create a file ‘autcd.cmd’ inside /a/b/c with a set of commands
- the moment someone does ‘cd /a/b/c’ , autocd.cmd should be executed.
Is there a simple way to do this other than hacking the filesystem?
You could globally alias
cd, and have that alias check the path being cd’d to. But otherwise, there’s no standard method for triggering something when someone enters into a directory. There’s never been a standard “autorun” type thing in Unix as there is on Windows (which is a good thing).