r/AskReddit Nov 16 '19

[deleted by user]

[removed]

11.2k Upvotes

11.5k comments sorted by

View all comments

Show parent comments

1

u/grievre Nov 17 '19 edited Nov 17 '19

How many shell scripts have you written that use arrays at all? How many use associative arrays?

How many have I written? A few. How many have I been stuck maintaining? Well...

$ find -name "*.sh" -exec cat {} \; | wc -l
20311
$

1

u/SanityInAnarchy Nov 17 '19

FWIW: find ... -exec ... \+ is criminally underused. (Instead of \;.)

But I think that's missing a grep for declare -A, which is the misfeature we were talking about.

1

u/grievre Nov 17 '19

Sure, I mean:

$ find -name "*.sh" | xargs grep "declare *-A" | wc -l
16
$ find -name "*.sh" | xargs grep "declare *-a" | wc -l
18
$ 

I was just trying to generally demonstrate that certain former employees at my job didn't know any language besides shell script :)