Bash Command "mkcd"

David A. Desrosiers david.desrosiers at canonical.com
Thu Feb 24 15:11:03 UTC 2022


On 2/24/22 05:30, Colin Watson wrote:
> I'm not the bash maintainer, but the bar for new shell builtins is
> rightly high since any additions would affect all systems, and I would
> expect this to be refused since it's easy to implement it as a local
> shell function with whatever behaviour and spelling you want.

Pretty straightforward:

     function mkcd() { mkdir -p "$@" && cd "$_"; }

man bash, and look at the 'Special Parameters' section for the use of 
the '_' param. You could also use "$@" there as well.

-- 
David A. Desrosiers
Principal Support Engineer (PSE/DSE), Canonical US
<david.desrosiers at canonical.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-devel/attachments/20220224/d202cfd0/attachment.html>


More information about the ubuntu-devel mailing list