[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] Preferred method wrapping mkdir
From: |
Greg Wooledge |
Subject: |
Re: [Help-bash] Preferred method wrapping mkdir |
Date: |
Fri, 13 Nov 2015 12:03:27 -0500 |
User-agent: |
Mutt/1.4.2.3i |
On Fri, Nov 13, 2015 at 08:55:17AM -0800, Joseph Pesco wrote:
> alias mkdir=cfs_mkdir
>
> cfs_mkdir () {
>
> local MKDIR=/usr/bin/mkdir
> $MKDIR ???$1???
> cd ???$1???
> }
mkdir() { command mkdir "$@" && cd "${@:(-1)}"; }
This allows you to do, for example, "mkdir -p /some/long/path" and have
it work as expected (ending with cd /some/long/path).