Live data from Hacker News

How Bash Completion Works

tuzz.tech

1–10 of 49 posts

Re: How Bash Completion Works

#6
Love the implementation.

Can't help but think about another "startup" or project that uses Machine Learning to predict your bash commands... which in most if not all cases is probably not necessary XD.

Re: How Bash Completion Works

#8
Nice article, it’s usually hard to keep a reader’s interest when writing about shell.

I will nitpick that COMP_LINE et al are shell variables, not environment variables - you can tell by the fact you don’t need to export the “return value”. (Scare quotes, as the function’s exit code, manually specifiable with “return NN”, is also called its return value.)

Re: How Bash Completion Works

#10
> `function _fizzbuzz () {`

I find that extra keyword distracting, when [POSIX.2 doesn't require it][1] and some folks going so far as to say to [actively avoid it][2]

Is there some good reason for it, or people are just used to a programming language requiring `fun` before a declaration, so it's programmer muscle memory?

_1: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V...

_2: http://mywiki.wooledge.org/BashPitfalls#function_foo.28.29

Post reply on HN