Re: mv command usability: rename file and create dest dir
From:
Bernhard Voelker
Subject:
Re: mv command usability: rename file and create dest dir
Date:
Sat, 1 Jul 2023 17:03:08 +0200
User-agent:
Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0
On 7/1/23 14:12, Sergey Ponomarev wrote:
> To rename a file a user need to use mv command and specify the DEST dir:
>
> mv /some/very/long/path/file /some/very/long/path/
>
> This makes it not so easy to use when typing a command but also makes a
> script line longer.
Assuming you meant
$ mv /some/very/long/path/file /some/very/long/path/file2
as in the other example - this could be done with:
$ cd /some/very/long/path && mv file file2
or (with GNU coreutils' env):
$ env -C /some/very/long/path mv file file2
Have a nice day,
Berny