[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Add dry-run option to mv
From: |
L A Walsh |
Subject: |
Re: Add dry-run option to mv |
Date: |
Wed, 10 Mar 2021 13:59:27 -0800 |
User-agent: |
Thunderbird 2.0.0.24 (Windows/20100228) |
On 2021/03/07 03:20, Emilio Garcia wrote:
Hi all,
I checked out the coreutils repo on Github and I would like to ask you
to add a dry-run option in the mv command.
----
When I've needed such functionality, I insert an 'echo'
before the 'mv' command, so in a script:
cmd=eval
if ((dry_run)); then
cmd=echo
fi
$cmd mv "fromfile" "tofile"
^^ that way my script will do the actual command like 'mv'
when cmd is set to 'eval', but in the "dry_run" case,
cmd will be set to 'echo' and instead of executing the command,
it will just echo it.
Does that work for you?