I want to extend the 'cd' command slightly so that I can execute some specific actions when entering (and leaving) a particular directory hierarchy.
So I need to create a bash function called 'cd' to do this, but I still need to call the underlying bash built-in cd. Is there any way of doing this?
Hi Chris,
On Thu, 2 Jul 2020 at 13:11, Chris Green cl@isbd.net wrote:
I want to extend the 'cd' command slightly so that I can execute some specific actions when entering (and leaving) a particular directory hierarchy.
Would there be some sort of auditing / file monitoring framework available instead?
So I need to create a bash function called 'cd' to do this, but I still need to call the underlying bash built-in cd. Is there any way of doing this?
Yes there is.
https://unix.stackexchange.com/questions/132623/order-of-executables-started...
See the answer about using the backslash. This one was new to me.
Thanks, Srdjan
On Thu, Jul 02, 2020 at 01:42:58PM +0100, Srdjan Todorovic wrote:
Hi Chris,
On Thu, 2 Jul 2020 at 13:11, Chris Green cl@isbd.net wrote:
I want to extend the 'cd' command slightly so that I can execute some specific actions when entering (and leaving) a particular directory hierarchy.
Would there be some sort of auditing / file monitoring framework available instead?
So I need to create a bash function called 'cd' to do this, but I still need to call the underlying bash built-in cd. Is there any way of doing this?
Yes there is.
https://unix.stackexchange.com/questions/132623/order-of-executables-started...
See the answer about using the backslash. This one was new to me.
Even simpler there's a builtin command 'builtin' which forces use of the bash builtin, just what I need, thank you!
‐‐‐‐‐‐‐ Original Message ‐‐‐‐‐‐‐ On Thursday, July 2, 2020 1:10 PM, Chris Green cl@isbd.net wrote:
I want to extend the 'cd' command slightly so that I can execute some specific actions when entering (and leaving) a particular directory hierarchy.
Sounds like a job for direnv: https://direnv.net/
Steve