Live data from Hacker News

Hush, a modern shell scripting language

hush-shell.github.io

81–90 of 192 posts

Re: Hush, a modern shell scripting language

#81
Why use types? Why not introduce built in parsers to provide validations instead? (i.e. https://github.com/antlr/grammars-v4)

I think hush is going in the wrong direction. The majority of shell automation is associated with running IaC and container images / orchestration tools.

Shell scripts don't need to follow functional programming or OOP. They need to be container-oriented / VM-oriented / image-oriented with a conformation to YAML notation as this is already the adopted norm for containers and IaC.

Re: Hush, a modern shell scripting language

#82
post #14

The language looks really quite interesting. I could see myself using it for quick scripts. I think I'd prefer bash's noclobber behaviour to be the default redirection style. The explicitness of being forced to >| always feels like a nice safety feature to me, which would tie in nicely with their other defaults for safer scripting. Also, not sure I'm keen on their minor change to the redirection syntax¹. It suggests…

> It suggests that "2>1" and "2> 1" have very different results

FYI, "2>1" and "2 >1" already have very different results in Bourne shell. So I don't think it's an unforgivable sin.

Re: Hush, a modern shell scripting language

#83

Earlier quoted context omitted.

Yes, I find it odd how there's a massive blind spot when it comes to powershell. Proponents of strong typing everywhere in their programming languages are put off by a shell that dares pipe objects rather than having everything as strings. I get that Unix has a long tradition and it's hard to change, but powershell is genuinely a modern shell that while uncomfortably verbose without aliases is extremely powerful and…

It blows my mind too. Typical verbosity argument is nonsense - people should use aliases. With cross platform shell, first time we have some reason not to use them, to make script more portable. Besides, this verbosity is form of documentation - you really must consider that any bash script comes with invisible man that you usually must check even after years of usage. When you factor that in, even fully verbose Powe…

It seems like the powershell occupies a different niche than sh/bash, etc. It seems more oriented towards manipulating system properties than sorting and grepping. At least, the examples are always about system objects and properties. I wouldn't even know how to integrate normal unix commands in the powershell. Things like this look pretty counter-intuitive: https://devblogs.microsoft.com/commandline/integrate-linux-c...

Re: Hush, a modern shell scripting language

#84
post #4

Is this really a shell scriping language? Hush isn't an interactive shell, nor does it compile to a common shell script. The only way to run these scripts is to install the hush interpreter and run the script through it. Isn't that just a normal scripting language? What's the real benefit of using this over Node or Python? I suppose the syntax is more aesthetically similar to shell scripts... but I don't exactly see…

> The only way to run these scripts is to install the hush interpreter and run the script through it

Exactly like any other shell, and consider how inconvenient and hazardous a transpiler "to a common shell script" would be.

Re: Hush, a modern shell scripting language

#85

I've changed my mind about this sort of thing recently. I disagree with the widespread belief that one should part with shell scripts as soon as possible. Yeah, there are definitely eventually scripts where one should rewrite the work in another language, but we now just have too many people who have no idea what getopts is, too many people who think bash is available everywhere, too many people who think it's a good…

I am a greybeard, old school kinda unix guy, but at some point insisting everybody learn latin to understand the scriptures is just not going to work. As long as Powershell dies I'm more than happy to agree that any bash script that exceeds 24 lines should probably be written in something newer.

Weird, because to me powershell gets very many things right.

Granted, it's a bigger more complex system, but in many cases it gets stuff done a whole lot better.

Re: Hush, a modern shell scripting language

#86
post #83

Earlier quoted context omitted.

It blows my mind too. Typical verbosity argument is nonsense - people should use aliases. With cross platform shell, first time we have some reason not to use them, to make script more portable. Besides, this verbosity is form of documentation - you really must consider that any bash script comes with invisible man that you usually must check even after years of usage. When you factor that in, even fully verbose Powe…

It seems like the powershell occupies a different niche than sh/bash, etc. It seems more oriented towards manipulating system properties than sorting and grepping. At least, the examples are always about system objects and properties. I wouldn't even know how to integrate normal unix commands in the powershell. Things like this look pretty counter-intuitive: https://devblogs.microsoft.com/commandline/integrate-linux-…

Sorting and grepping in PowerShell are an every-day trivial thing.

I even use it to as data analytics tool to query moderate amount of data because its just simpler then using anything else (given that ConvertFromTo-XML,Json,Csv etc. are integrated, standard, and don't require bunch of other tools like jq, miler etc.) and I can send it to anybody along with the data to reproduce it or tweak it without having to install anything or learn any new language.

> At least, the examples are always about system objects and properties

Not sure where you get that idea from. Third party examples are not important at all. Majority of usage has nothing to do with the system and its properties.

Not sure why you mentioned that particular method of invoking WSL stuff. If anything, it shows how powerful PowerShell is.

Re: Hush, a modern shell scripting language

#87

Earlier quoted context omitted.

Yes, I find it odd how there's a massive blind spot when it comes to powershell. Proponents of strong typing everywhere in their programming languages are put off by a shell that dares pipe objects rather than having everything as strings. I get that Unix has a long tradition and it's hard to change, but powershell is genuinely a modern shell that while uncomfortably verbose without aliases is extremely powerful and…

It blows my mind too. Typical verbosity argument is nonsense - people should use aliases. With cross platform shell, first time we have some reason not to use them, to make script more portable. Besides, this verbosity is form of documentation - you really must consider that any bash script comes with invisible man that you usually must check even after years of usage. When you factor that in, even fully verbose Powe…

> I have never seen good argument against PowerShell

As long as I have to type `Get-Content` instead of `cat`, that's argument enough for me.

Re: Hush, a modern shell scripting language

#89

Earlier quoted context omitted.

It blows my mind too. Typical verbosity argument is nonsense - people should use aliases. With cross platform shell, first time we have some reason not to use them, to make script more portable. Besides, this verbosity is form of documentation - you really must consider that any bash script comes with invisible man that you usually must check even after years of usage. When you factor that in, even fully verbose Powe…

> I have never seen good argument against PowerShell As long as I have to type `Get-Content` instead of `cat`, that's argument enough for me.

But you can - `cat` is alias to Get-Content (one of).

Better, use `gc` Its shorter then `cat` and almost immediately guessable what it does if you know that aliases in pwsh are also named by the standard. "Cat" on the other hand has almost nothing to do with original intent (I am not concatenating stuff, I am getting a content so, the problem with that name is the same as with "magic numbers" in general programming)

Re: Hush, a modern shell scripting language

#90

I've changed my mind about this sort of thing recently. I disagree with the widespread belief that one should part with shell scripts as soon as possible. Yeah, there are definitely eventually scripts where one should rewrite the work in another language, but we now just have too many people who have no idea what getopts is, too many people who think bash is available everywhere, too many people who think it's a good…

As you can probably guess from my username, I am among the last people who would disagree on the usefulness of common shell utils, and the benefit of knowing them.

But I still hold that one should rewrite into a proper programming language, as soon as a shell script becomes too large, and that point is usually around the 100 LOC mark. Yes, I can do amazing things just with sh/bash and the coreutils. But a small Go program or python script, is just alot more readable, at least imho, because they impose STRUCTURE, which the shell lacks on purpose: It's a CLI first, and a programming language second.

I can read through several hundred lines of Go in one sitting. When asked with analyzing some old bash script, and `wc -l` tells me something along the lines of 400+, I grab the coffee machine and bring it to my desk.

Post reply on HN