[PLUG] a question on "mv" command

wes plug at the-wes.com
Wed Oct 4 03:51:12 UTC 2017


On Tue, Oct 3, 2017 at 8:20 PM, VY <vyau5678 at gmail.com> wrote:

> Thanks again for all the replies.
>
> I have a further question on this.
>
> Is doing "mv *" considered "bad coding"?
>
> In general, no matter which language I do, I try to avoid any side-effect.
>
> It reduces readability in the code.   Hard to debug when you have pages
> after pages of code that consists
> of a lot of "side effects".
> I much prefer
>
>   "mv a c"
>   "mv b c"
>
> if I want to move directory a and b into c.
>
> Am I old school or is this not applicable in shell scripting?
>
>
If nothing else, it's impractical to say the least... how often do you have
to move everything in a directory (except the final entry in the list) into
one directory, which happens to be that final entry?

And even if that were somehow reliably the case, imagine yourself coming
back to read your code after a year or two has passed. Will you understand
what it's doing then? That should be your #1 concern.

-wes



More information about the PLUG mailing list