Live data from Hacker News

Type-ish – A runtime type checker for bash, in bash

github.com

1–10 of 19 posts

Re: Type-ish – A runtime type checker for bash, in bash

#3
post #2

This looks pretty cool! I can't ever imagine using it tho :) If my bash scripts are so complex or critical that I feel the need to type check, I will probably use another scripting language where I can do that more easily while still having readable code.

If you ever check your arguments for any properties then this could still help, you'll have a systematic approach instead of an ad hoc one.

Re: Type-ish – A runtime type checker for bash, in bash

#6

> the builtin types are: > [...] > boolean: a shortcut for returning a number (as numbers are booleans). Can someone explain? I can understand booleans being numbers (e.g. #define TRUE 1 in C), but how are numbers booleans in bash?

Booleans in shell scripts are little more than zero (true) and non-zero (false) exit codes.

Re: Type-ish – A runtime type checker for bash, in bash

#7

> the builtin types are: > [...] > boolean: a shortcut for returning a number (as numbers are booleans). Can someone explain? I can understand booleans being numbers (e.g. #define TRUE 1 in C), but how are numbers booleans in bash?

Booleans in shell scripts are little more than zero (true) and non-zero (false) exit codes.

Ok, right. But then it should still say either "booleans are just numbers" or "numbers can be interpreted as booleans, i.e. are truthy or falsy".

Re: Type-ish – A runtime type checker for bash, in bash

#9
post #8

Since no one has said it yet, please always use https://www.shellcheck.net/ on your scripts, you don't want to be That Guy https://github.com/ValveSoftware/steam-for-linux/issues/3671

Oh I do love reading those... Shame that shell scripting is still treated as mysterious command line voodoo, even Microsoft has Powershell now showing how powerful the concept is that even they couldn't avoid it entirely

Re: Type-ish – A runtime type checker for bash, in bash

#10
post #8

Since no one has said it yet, please always use https://www.shellcheck.net/ on your scripts, you don't want to be That Guy https://github.com/ValveSoftware/steam-for-linux/issues/3671

Ah, wow. I like that they ported the accidental behavior deliberately into Windows:

Warning: The uninstallation process deletes the folder Steam was installed to to ensure it is fully uninstalled. If you accidentally installed Steam to a folder containing other data, for example C:\Program Files (x86)\ instead of C:\Program Files (x86)\Steam\..."

Post reply on HN