How to extend a bash built-in but still use it within the new function?

Karl Auer kauer at biplane.com.au
Fri Jul 3 09:24:14 UTC 2020


On Thu, 2020-07-02 at 13:10 +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?

Yes. Read "man bash" and look in the "SHELL BUILTIN COMMANDS" section
for the "builtin" command.

Regards, K.

-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Karl Auer (kauer at biplane.com.au)
http://www.biplane.com.au/kauer
http://twitter.com/kauer389

GPG fingerprint: 2561 E9EC D868 E73C 8AF1 49CF EE50 4B1D CCA1 5170
Old fingerprint: 8D08 9CAA 649A AFEF E862 062A 2E97 42D4 A2A0 616D





More information about the ubuntu-users mailing list