News for hackers. Stuff that matters.
Re:Shell-ish scripting in Go with ease by graerg on Friday January 31, 2025 @05:10PM (#42892829)
>A Sysadmin would take 5 minutes with a shitty language and a shitty tool and get way more done in less time.

Most people aren't sysadmins, but occasionally have to do sysadmin-like things. I've been programming with python and go for years. I've never been able to get the "core" command line utilities to really stick in my head. A sysadmin uses them every day, whereas I rarely have to reach for them. On the rare occasion when I _do_ have to reach for them, it is excruciating (what was the flag I need for `find` again?). If it were life or death and I had to debug even the simplest sed/awk command, it would be death for me! But this package makes perfect sense to me and really enables me to write this sort of quick and dirty thing in a language I'm familiar with and can confidently maintain.

This isn't for everyone, but there's definitely a population that can get a lot of value out of this.

Re:Shell-ish scripting in Go with ease by wpm on Friday January 31, 2025 @06:04PM (#42893440)
>what was the flag I need for `find` again

This is not on you, `find`'s command line syntax is awful even if you have to use it everyday.

Re:Shell-ish scripting in Go with ease by mbreese on Friday January 31, 2025 @06:09PM (#42893487)
And don’t forget GNU vs BSD version differences…
Re:Shell-ish scripting in Go with ease by sgarland on Friday January 31, 2025 @08:53PM (#42894857)
That’s why you install gnu-coreutils. Eliminate the difference.
Re:Shell-ish scripting in Go with ease by oguz-ismail on Friday January 31, 2025 @09:10PM (#42894961)
> `find`'s command line syntax is awful

What's awful about it?

Re:Shell-ish scripting in Go with ease by DaSHacka on Friday January 31, 2025 @11:25PM (#42895634)
Everything? It, just like tar, don't follow the convention of many other CLI utilities.

That alone is why I prefer `fd` or plocate for most tasks I previously used find for.

Re:Shell-ish scripting in Go with ease by oguz-ismail on Friday January 31, 2025 @11:45PM (#42895724)
Never heard of plocate but I thought fd a step down from find; it's very limited in functionality, colorful output alone can't justify that.

> [It doesn't] follow the convention of many other CLI utilities.

Because unlike other CLI utilities, find evaluates an expression specified as arguments. Maybe a small DSL like JQ would be better, but how would you embed shell code in it? Meh.

Re:Shell-ish scripting in Go with ease by DaSHacka on Saturday February 01, 2025 @12:39AM (#42895984)
Find has its uses, I use it frequently to correct improper unix file permissions and owners and when I need to execute a command on a list of files.

However for the vast majority of queries, I'm only looking for something based on the filename, and that's where having sane regex and standard argument structure (like fd has) is great.

Re:Shell-ish scripting in Go with ease by oguz-ismail on Saturday February 01, 2025 @01:41AM (#42896278)
> for the vast majority of queries, I'm only looking for something based on the filename

I'd manage with find|grep but yes, nothing wrong with wanting something more compact.

> sane regex

For me that's POSIX ERE, I don't know which flavor fd uses.

Re:Shell-ish scripting in Go with ease by Zamiel_Snawley on Friday January 31, 2025 @11:15PM (#42895592)
LLMs are pretty good at using the standard utilities.

That, combined with reading the man pages if it doesn’t work first try has been really effective for me.

Re:Shell-ish scripting in Go with ease by 0xbadcafebee on Saturday February 01, 2025 @04:46AM (#42897200)
I completely understand this perspective. But it helps to consider your broader choices.

Let's say you're an "Engineer" engineer, and you deal with units of measurement. You grow up in the US, so you first learn the Imperial system. But so much of the rest of the world uses Metric measurements. Do you find and acquire Imperial versions of every tool, fastener, etc, because it's what you're familiar with? Or do you learn Metric as well, so you can access all of the tools, fasteners, etc found all over the world?

Or take an example from a thousand years ago. Say you're a trader in the Mediterranean and you want to sell your wares. Do you only sell in your local town, where everyone speaks your dialect? Or do you pick up the "Frankish Language", the pidgin language spoken by sailors and other Western Europeans? Learning this mix of Venetian, Catalan, Portuguese, Tamazight, Turkish, Greek, and Arabic will give you extra skills you can use to trade with a vast array of peoples.

POSIX is the closest we have to a 'Mediterranean Basin' for operating systems, and shell scripting is its pidgin language. You don't have to learn it to make a living, but it sure as hell helps.

Re:Shell-ish scripting in Go with ease by solidsnack9000 on Saturday February 01, 2025 @10:40PM (#42905575)
I mean, no one really remembers all the flags. They remember a few common ones, due to using them over and over again.

If you are making a genuine effort to avoid the shell, you won't ever learn these basic flags -- you are holding yourself back. It is like a person complaining about using the stairs -- "On the rare occasion when I _do_ take the stairs, it is excruciating..." -- the problem is not necessarily with the stairs.

Re:Shell-ish scripting in Go with ease by graerg on Saturday February 01, 2025 @10:51PM (#42905643)
I totally agree. My counterpoint is that this tool is the equivalent of portable stair lift. Yes, it may hinder me from developing the ability to walk up the stairs, but I'm fine with that. The only thing that matters is that I get up the stairs.