duckduckgo / zeroclickinfo-goodies

DuckDuckGo Instant Answers based on Perl & JavaScript
https://duckduckhack.com/
Other
977 stars 1.77k forks source link

Shell cheat sheet: ambiguous or incorrect #2022

Closed mbionchi closed 8 years ago

mbionchi commented 8 years ago

The file in question is: https://github.com/duckduckgo/zeroclickinfo-goodies/blob/master/share/goodie/cheat_sheets/json/shell.json If this cheat sheet is for bash (as the source URL implies), then the Variables section is incorrect. Otherwise it's just ambiguous what shell language the cheat sheet is for.

MrChrisW commented 8 years ago

Hi @mbionchi !

Which variable are you referring to ? They look correct to me. Do you mean the wording? "Shell" should be "Bash"?

Variables:

Thanks

mbionchi commented 8 years ago

Hey @MrChrisW,

I meant the Variables section, not Builtin Variables. Here it is:

"Variables": [
    {
        "key": "$hello = \"Hello World\"",
        "val": "Initialize a variable"
    },
    {
        "key": "$hello = \"1 2 3 4 5\"",
        "val": "Initialize a list"
    }
],

$var = "val" is not the way you assign variables in bash. If the cheat sheet is about bash, it should be changed to HELLO="Hello World" or possibly merged with the existing bash cheat sheets, e.g. bash.json or shell-variables.json.

MrChrisW commented 8 years ago

@mbionchi Your absolutely right.

I'm not actually sure why there's a "bash" cheetsheet and a "shell" cheatsheet when the original source link points to bash cheatsheet.

Either way the correct way to perform a variable assignment in both a POSIX shell and Bash is HELLO="Hello World"

I'm in favor of removing the shell cheatsheet completely and possibly improving the bash cheatsheet with the "Conditionals" and "Loop" sections of this sheet.

Are you interested in lodging a PR to remove the shell.json file and updating the bash cheatsheet?

mbionchi commented 8 years ago

Yes, absolutely. I'll start working on it.