This example shows nicely how ugly text processing is: you have to use head and tail simply to trim out the first line of ls (the total).
I think it doesn't even work correctly. ls lists files and directories and then picks the first 4 (it should only select files).
And this also uses awk and jq, which are not just simple "one purpose" tools, but pretty much complete programming languages. jq is not even part of most standard installations, it has to be installed first.
I'd replace the first part with (which isn't any shorter, but in general if I want a list of files for a pipeline, find is usually more flexible than ls for anything but the most trivial):
find -maxdepth 1 -type f -printf '%s %f\n' | sort -n | head -n 5
For the latter part, I'd tend to think that if you're going to use awk and jq, you might as well use Ruby.
("-nae" effectively takes an expression on the command line (-e), wraps it in "while gets; ... end" (-a), and adds the equivalent to "$F = $_.split" before the first line of your expression (-n))
It's still ugly, so no competition for nushell still.
I'd be inclined to drop a little wrapper in my bin with a few lines of helpers (see my other comment) and do all Ruy if I wanted to get closer without having to change shells...
It's close, but there are some things that could be better to make it easier to access e.g. file size and type. I think maybe a 50-100 line set of helpers and a one line wrapper (to spawn Ruby with -r<helper> -e <command line>) would get you mostly to where nushell is.
> And this also uses awk and jq, which are not just simple "one purpose" tools, but pretty much complete programming languages
In a way that exactly illustrates the GGP's point: why learn a new language (nushell's) when you can learn awk or jq, which are arguably more generally- and widely-applicable than nushell. Or if awk and jq are too esoteric, you could even pipe the output of `find` into the python or ruby interpreters (one of which you may already know, and are much more generally applicable than nushell, awk, or jq), with a short in-line script on the command line.
> awk or jq, which are arguably more generally- and widely-applicable than nushell
That is backwards. I know I said "complete programming languages", but to be fair, awk only shines when it comes to "records processing", jq only shines for JSON processing. nushell is more like a general scripting language — much more flexible.
Unfortunately, I don't think Nushell brings much benefit for folks who already know Bash enough to change directories and launch executables and who already know Python enough to use more complicated data structures/control flow/IDE features
I'm still rooting for Nushell as I think its a really cool idea.
For me the blocker was having to switch to bash/powershell when moving to a different machine (ie: servers, work machine, etc..). I would end up needing to redo same things to be compatible with the existing tools; eventually I just gave up and got used to readily available shells instead.
Ok if it's not for you. But there is of course a very good reason — work with objects in the pipeline instead of "dumb text". Also PowerShell and nushell are quite nice to learn, whereas Bash is absolutely horrible.
I wonder if this is a case of "worse is better", or just the long-term entrenchment of text. Because nushell hasn't been adopted all that much compared to bash or even zsh (or a "real" scripting language like python or ruby). I don't know much about PowerShell adoption (haven't used Windows in over 20 years), but I'd assume since it's a first-party system that's default installed(?), it's done better adoption-wise.
I agree that bash sucks, but I really have no motivation to learn something like nushell. I can get by with bash for simpler things, and when I get frustrated with bash, I switch to python, which is default-available everywhere I personally need it to be.
Back to text, though... I'm honestly not sure objects are strictly better than dumb text. Objects means higher cognitive overhead; text is... well, text. You can see it right there in front of you, count lines and characters, see its delimiters and structure, and come up with code to manipulate it. And, again, if I need objects, I have python.
I get the point of "either Bash or straight to a real programming language". That's what I do too, for automation. I like how PowerShell makes one-off tasks easier which would otherwise be the typical pipe of cat, grep, sed, awk etc.
Well, the reason is you can stop using Bash. If you never write Bash scripts already then you probably don't need it (and also congratulations on doing things right), but most people at least have lazy colleagues that write shell scripts. One day I'd like them to be not awful.
Ehhhh, that's a bit of a false equivalence. Most communist/anarchist/etc are "for the people", and the people in question are often marginalized or oppressed groups with little to no institutional power.
Fascists, on the other hand are "for our people", and the "our people" bit often means White, rich, me and mine type thing. A good example is how the American right-wing often talks about immigration. They'll talk about a mythical "good immigrant" from a south American country, we can let them in because they're "one of the good ones". Not like those other brown people, of course.
Authoritarianism. And there's a huge argument to be made that communist states were and are corrupted not by their principles but by the pressure capitalist states place on them.
And to be clear so I don't get dogpiled and dox'd for this later. I don't think that excuses the blood that was shed. I do not think a state has a right to terrorize it's populace into submission, regardless of the ideological motivations for doing so.
No human being has the right to determine if another human being should live or die. That's not power. That's not authority. That's cowardice. Sadly we have ideologies and religions that think otherwise.
In principle I agree with you but the "pressure" you mentioned means my view on this is sort of like Bjarne Stroustrup's take on programming languages: there are political systems that people complain about suppressing dissent & interference in their nascent stages, and ones that nobody lives under.
Just like Stroustrup's formulation, this can become a cover for unnecessary and mistaken excesses, but I don't necessarily think that's inevitable.
I'd like to see that argument. Russia pre-WWII and Mao's China don't seem to me to have much capitalist pressure against them, yet Stalin and Mao killed millions. Stalin's purges were internal, against people who were on his bad side. Now, you could say that maybe Western spies agitated, but there's no way that Western agitation would account for millions of people. Furthermore, in 1930, the Communist system was widely seen as successful, since initial food production in the USSR was strongly up. Mao's deaths were incompetence (famine: killing sparrows, resulting in sparrows not eating insects the next year; famine: misallocation of resources, causing starvation in Sichuan when enough food existed elsewhere; Cultural Revolution: Mao's reaction to losing his grip on power). I think China was so poor that it realistically did not interact with the rest of the world, but in WWII, the US actually helped the Communists.
Every other Communist state that I am aware of also killed millions in internal purges: Cambodia and N. Korea, notably. I'm actually not sure what happened with Vietnam and Cuba. I'm not sure if contemporary Venezuela counts as Communist, but I am under the impression that there was killing or at least persecution of internal political enemies. I don't see how US sanctions have anything to do with how one treats political enemies.
I guess Eastern Europe might be an exception, but I think that is because Communist states were imposed with external force, not revolution from within, and the population mostly capitulated. However, I believe that political opposition was still likely to be deadly.
Since Communist states seem to be highly correlated with killing internal enemies, it seems like a feature of the system, not a response to external pressure, particularly since the largest two did not have serious external pressure at the time.
As someone who is falls pretty hard into what is considered the "radical left", facists are much worse. There are a lot of really annoying leftist, and there are a lot of reactionary authoritarian communist that often mirror the far right but prefer Stalin to Hitler.
But the majority aren't much more to the left of bernie sanders, and the minority that is are often too busy cooking meals for the unhoused, organising clothing drives, and trying to do harm reduction in our local communities.
It's more complicated, obviously, but most lefty types nowadays just want everyone to be fed and housed.
“Much worse” is what you say when you know little to nothing about what Mao and Stalin did to say nothing of Xi. Completely horrifying repression, mass murder, famine, and death.
You can pick a “worse” but to act like it’s an easy call is just pig ignorance.
Communists are worse in number of dead, and in how persistent their madness is. Fascism is functionally dead, while communism is quite powerful and still incredibly damaging.
Fascism is not functionally dead. We just don't have governments actively calling themselves Nazis and fascist. The modern day christian nationalist movement in the United States is a fascists movement, and that's without even getting into the actual neo-nazi and white supremacist groups that also have ties to people in power.
Like I said to another comment, I thought we were discussion the modern right wing and left wing movements happening now, I'm not sure why we're bringing up previous communist movements. Seems irrelevant to my comment.
One day I aspire to be able to fully comprehend Cheney on the MTA. I kinda get it? But I've never learned C, and never had to slog through manual memory management, so it's a little lost on me
Statistics tells us that probably means it's the only frog of this species in the area. In fact we use a related approach to estimate true populations.
But as they admit, that's only one possible reason.
The company I work at hired a vendor for their call center software, and said vendor spammed out all kinds of emails to everyone in the org on a daily basis. It was annoying and entirely useless. I just kept reporting them as phishing attempts and encouraged my coworkers to do the same. It worked.