CodeSOD: Just a Copy of Copy

This post was originally published on this site

The Daily WTF

I don’t think anyone would argue that BASH provides a good scripting environment. It provides a commonly available scripting environment that even its successor shells attempt to emulate. But it’s idiosyncratic, at best, and leads to bug-prone scripts.

But there are certain tasks that it excels at- specifically, the kinds of tasks that you’d normally do from the shell but just want to wrap some light automation around. Want to scan a directory and then copy some subset of the files out based on user arguments? BASH is your friend! It’s just some basic conditionals and some cp commands, what could be easier?

Well, I’m not sure, but Radu‘s predecessors found a way to make it harder. Because they didn’t use the cp command anywhere. ANd why should they? I mean, look at the flags documented on the man page: cp [-R [-H | -L | -P]] [-fi | -n]

To read the full article click on the 'post' link at the top.