How to extend a bash built-in but still use it within the new function?
Chris Green
cl at isbd.net
Thu Jul 2 12:56:49 UTC 2020
On Thu, Jul 02, 2020 at 01:10:31PM +0100, Chris Green 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.
>
> 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?
>
A bit more searching and I found that bash has a builtin command
called 'builtin' which forces use of a builtin command. Thus I just
need to put 'builtin cd' instead of 'cd' in my function.
--
Chris Green
More information about the ubuntu-users
mailing list