News for hackers. Stuff that matters.
Re:Always bet on text (2014) by simoncion on Sunday September 27, 2015 @11:12AM (#10286767)
All good advice. I was intentionally making a correctness/terseness tradeoff. :)

> ...and arguments be expanded correctly with "$@"

That assumes that your bash is contained within a script, yes? It doesn't work for commands entered directly in a shell?

> ...unless you're using a really ancient version of bash, you shouldn't use backticks for command substitution.

I was -stupidly- unaware that backticks would nest. I always use $() when I want to nest command substitutions.

> "find ." and "find ./" are identical.

Oh, I know. I have the largely unjustifiable habit of always putting a path in a find invocation, as well as always spelling "the current directory" as ./

> > find | xargs

> Of course, this is always a nice option that bypasses the need for bash.

Don't forget -print0 and -0 if you expect to have to handle arguments that contain spaces! ;)

Re:Always bet on text (2014) by pdkl95 on Sunday September 27, 2015 @02:26PM (#10287381)
> That assumes that your bash is contained within a script, yes?

Or a function. (that is, anywhere the $1, $2, ... variables are available, as "$@" (must have the double-quotes!) just copies $1, $2, .. without changing the word splitting.

> as well as always spelling "the current directory" as ./

That's actually a very good habit to be in a lot of other commands. It's unnecessary with find, but it's harmless either way.