[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFE] mkdir w/chdir
From: |
Eric Blake |
Subject: |
Re: [RFE] mkdir w/chdir |
Date: |
Tue, 3 Sep 2019 15:34:54 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 |
On 9/3/19 3:12 PM, Vito Caputo wrote:
> Hello list,
>
> Lately I've been finding myself wishing there were a flag for mkdir to
> cd into the directory, especially in combination with creating parents.
>
> It's like I'm already thinking in convenient shortcut mode asking for
> parents to be created and just want to throw another flag in there to
> switch my directory as well in the same command.
>
> i.e.
> short: mkdir -pc /foo
> long: mkdir --parents --chdir /foo
>
> Any chance of getting this in or too creepy?
It can't happen in coreutils. The current working directory of the
shell CANNOT be influenced by the actions of a child process, which
coreutils would necessarily be.
It can, however, be done in the shell, if your shell author is
interested in writing a builtin version of mkdir (to match the fact that
chdir is already a shell builtin, for what should be obvious reasons).
However, you don't even have to modify the shell source code, but
instead just write a function to do the two steps in one function call.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3226
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature