> A lot of people coming from the Unix-like world of macOS and Linux don't tend to know [PS]. Many people don't know it even exists at all. When I mention the Windows Terminal to people, they think I'm talking about the Windows Command Prompt, a crappy little program
I know that PS and the new terminal is not the same as cmd.exe, and that it has advantages like passing objects through pipes instead of stringly typing everything the way that sh-like shells work. But that's about the extent of it. (The powershell command names though, oh boy, even Java method names are better than that.)
Just wondering if you're talking about command name length or something else?
Asking because it comes up a lot and almost all the common commands have idiomatic short/terse versions (gci for Get-ChildItem, etc).
No shade, though. No reason you'd know if you don't have a reason to know it.
Would love to hear if I'm making the wrong assumption and it's something else you're talking about. I personally really love powershell, but also get why people love bash. I'm still pretty comfortable with bash because I work in *nix systems mostly, so it makes sense for me to know it, whereas the reverse (with ps) isn't really true for most devs
A lot has been written about naming things and brevity versus clarity, and while I sit very firmly on the programmer's side as opposed to the math people side (single letter variable names, in weird fonts or languages if they (surprise!) run out of available letters), I think I am more of a bash person than a java person in terms of naming things. Word-ish commands like pushd, kill, read, etc. (taking some bash built-ins here as examples, rather than external programs which may be named arbitrarily) seem a lot nicer to me than either very long commands or acronyms where you basically still have to know the long form to remember it. I'd never have guessed that spps stands for stop-process yet that's the portable powershell form of 'kill' (just looked that one up).
Kill is intuitive to you because you've probably been around tech your whole life, and tech has just used "kill" ever since. It's essentially as ubiquitous as "bug".
That said, if I had to teach someone brand new with next to no skills (the endless goal of making coding easier for the average person and so on), Stop-Process is a hell of a lot easier to teach, or rather, it's much easier to teach them to help themselves.
Since it follows the same naming template as every other powershell command, if you teach them how to use the basic commands like Get-Help/Get-Command, they're a hell of a lot more likely to figure it out themselves without needing assistance. You know that every cmdlet is verb-noun, and you know you're trying to stop a process, so something like
> Get-Command "*process*"
Gives you a short list that is extremely intuitive to figure out.
Now...for something as simple as "kill" you're not expecting a beginner to run a command with a wildcard search. You'll just tell them. But that entire philosophy is extremely helpful when you're in a situation where you do need to figure out the command and don't have the ability to just spend however many minutes on google, and if you teach PS right you get to a point where it's very easy to teach yourself.
Obviously how much this matters in a world of IDE's and search engines and now AI is questionable, but I think that if you redid bash today, it'd follow similar philosophies. Things like touch, grep, and arguably even echo really strike me as "favorites" just because of the inertia/ubiquity.
The VSCode powershell extensions will also give you suggestion squigglies under all of your aliases in a saved script if they're not long-form, but I usually mix and match based on pragmatism.
My use of alias vs long-form usually comes down to two sort of situations:
* Ad-hoc at the shell: all aliases all the time (and make my own if I need to. welcome to my godless wasteland, population: me) * Shared scripts: Just like any code, do what's idiomatic for the team. Usually it's largely aliases with some long-form
In practice I'd say the formatting consistency situation on teams isn't nearly as bad as SQL but obviously not as good as Go.
For reference, I'm also a huge APL fan, so hit me with arcane symbols in my free-time all day long, but definitely pragmatic balance at work.
I also don't even think of them as acronyms personally. The acronym just sort of means the semantic action in my brain at this point, but I think that's mostly a fluency thing, and can't really speak to it being hurtful/helpful since I'm so removed from when I first started learning it
there are also some commands I use all the time that don't have built in aliases like the json converters, so that makes cross-machine alias consistency for some important things not great
Bash is a write-only-full-of-bugs language, comparatively.
It means that working in the terminal, you can use short commands, and when you write a long-term script, you use the long names so that the script is more readable.
What I find great is that flags also have aliases that are standardized across commands.
This is why I'm annoyed at this meme. It just stems from ignorance.
But I do get what you're saying and think it's a common meme that's often unhelpful
I don't use it, because I was Mac/Linux at home and Linux at work for so long - only now do I have a reason to.
I love powerful. I've used it for a long and even though I primarily work on macos/linux now, I install powershell core on everything.
That said, I _started_ using it because I was working on a windows box doing C# and managing windows servers.
There's just not a compelling reason for a dev to learn it outside of personal interest, and I think that's a completely legit mindset, since we all have limited time. I'm even fine with misconceptions--we all have them about something--as long as the person is being a decent human about it (which is why I've enjoyed this thread/comments)
Otherwise, despite their length I do like these long names, you can have aliases for ‘ls’ and alia, and flags fuzzy match.
I volunteered to help a local nonprofit image a bunch of laptops and they'd bought win 10 home licenses for something like 30 laptops. The whole thing was kind of a nightmare but got most of the adware stripped out, I think, but not all of it. been awhile, so hard to remember
I'm glad that the OP has a workflow that they like, but I'm not really convinced the grass is greener on the other side. I've used a lot of shells, Powershell doesn't really wow me that much anymore.
`$someJsonText | convertfrom-json | % name`
the `| % [property name]` is shorthand for pulling out some root level property on an object in the pipeline
(just for reference; not really trying to prove any point)
What I personally like about PS in this case is that the syntax of the operation feels very consistent with the rest of powershell, but that's not a dig against jq (I use it a lot when I'm on macos); just my subjective impression, and not an objective claim of quality.
Get-Help ForEach-Object
...
ALIASES foreach %
The ForEach-Object cmdlet works much like the Foreach statement, except that you can't pipe input to a Foreach statement. For more information about the Foreach statement, see about_Foreach.
https://learn.microsoft.com/en-us/powershell/module/microsof...And another appears to be performance
PS /home/me> $time = (Measure-Command {
>> 1..1E4 | ForEach-Object {
>> $_
>> }
>> }).TotalMilliseconds
PS /home/me> [pscustomobject]@{
>> Type = 'ForEach-Object'
>> Time_ms = $Time
>> }
Type Time_ms
---- -------
ForEach-Object 144.558
PS /home/me> $Time = (Measure-Command {
>> ForEach ($i in (1..1E4)) {
>> $i
>> }
>> }).TotalMilliseconds
PS /home/me> [pscustomobject]@{
>> Type = 'ForEach_Statement'
>> Time_ms = $Time
>> }
Type Time_ms
---- -------
ForEach_Statement 17.621
https://devblogs.microsoft.com/scripting/getting-to-know-for...Though I was referring to the cmdlet, you're absolutely correct.
C# is not-so-secretly my favorite language (though Clojure is a close second) and I use it pretty often on macos/linux.
IDE wise have you given Rider a try? Imo it's a totally viable Visual Studio replacement for most C# dev, though not as nice for all workflows or related tech.
Worth looking at if you haven't. It's not free, though, so that can blow depending on your tolerance for licensing. I've personally had an all-products pass with jetbrains for awhile now, so doesn't bug me, but ymmv
I also get a lot of mileage out of C# notebooks in VSCode. Honestly, I use C# for a ton of my daily scripting because I built up so many utility scripts over the years in LINQPad on windows, and they were pretty trivial to port
Checking it out quickly, it's from JetBrains (a good sign for software quality) and has a 30-day trial so I'd know what I'm paying for. On the downside, ~175€ is quite steep given that it's not for a commercial purpose and I am currently fine getting my programming done in pluginless Vim. And that's not a one-time payment: that's for the first year. I can't just move on for a while and come back to expect to open up a project file and it to just work :/. I think this is not going to be for me at this price point, though the 30 days trial might be a challenge mode to start and finish a project that I might otherwise never finish at all!
Edit: And I wasn't even yet talking about your comment history. Spotted two insightful comments while skimming the top level of the first page of comments (I stopped there), and that already takes me all the way back to 2015. Not saying you must post more if you don't want to but e.g. the timer tip seems to have helped a lot of people :)
Thanks! I really appreciate that. Been kind of a bummer year so it's nice to hear (#layoff problems, so I'm definitely not the only one, and I think that's looking up recently)
I don't think I'd get Rider by itself, either. I was doing consulting for awhile and ended up getting the jetbrains all product thing personally because was jumping between Goland, Rider, Webstorm, and Rubymine, and Datagrip a lot (I honestly don't remember which are paid now). I got it personally because I ended up using it so much. I ended up using CLion (which is paid) for learning Rust, too, which was nice.
definitely check out the 30 day trial. And 100% JetBrains knows what they're doing
Have to dip, but feel free to ask whatever questions and I'll check it out when I get back. No pressure either way.
I do use Rider 50/50 with big Visual Studio though. Mostly because I feel that the need to eventually switch to Linux is creeping as Windows adds more junk.
The one thing I don't like about Rider vs Visual Studio + ReSharper is that ReSharper has some really advanced structural/semantic searches that haven't made their way into Rider. I don't use it a ton, but being able to do queries across the AST annotated with semantic/type info is really useful if you're working on a legacy C# project that's been copy pasted fifty times--once per state (actual thing that I ended up working on)
otherwise, Rider is rad, and I have way more intellij platform bindings and such setup for them all
Mind you I had the all products pack for a while now, so YMMV.
Anyway, yeah, Rider by itself isn’t cheap but for not a lot more you can just get the entire JB suite. It includes a whole ton of useful stuff that’s multi-platform and multi-language. When I’m doing Mac dev work, I find Rider to be much better for a lot of things than VS Mac is. (As long as I don’t need Azure integration.)
I could get my employer to reimburse it, but I find it all so useful both for work and for personal projects that I decided it was worth just paying out of pocket and not having to worry about it.
For PS, the other thing is I think people hear "object-oriented shell" and think every command has to be custom-built to interface with all the others and isn't pluggable like standard pipes, but that is untrue.
We all have different experiences of life but I have never found this to be the case. Linux users are savvy and curious about things even outside their bubble.
The only people I can imagine this being true for is the true greybeards who have been daily driving Linux for 20 years.
Uh, not, in that case the shell is not involved at all. The kernel implements shebang and will automatically start the interpreter, whatever it is, without having to go through the shell.
Proving my point more and more here…
It's impolite to get offended.
Obviously, this conversation is based on your misunderstanding of the original post and so I dont think its a worthwhile use of either of our time to enumerate the chapters and system calls from a college class. Knowing how processes are created in a generic operating system is not the same thing as knowing how shebangs work on unix-like systems. Again, OS class is about how to MAKE an operating system, not how to use one
A waste of time indeed.
It's not the shell, it's the kernel that interprets the so-called shebang. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/lin...
Edit: oops, should have previewed, cryptonector beat me to it.
Actually, that did happen. Quoting https://utcc.utoronto.ca/~cks/space/blog/unix/ExecAndShebang...
"In V7 (and versions before it), the exec*() family of system calls only worked on actual binary executables. In order to make shell scripts more or less work, the shell (and I think perhaps some other programs) reacted to an ENOEXEC error by assuming the executable was actually a shell script."
And yes, the ridiculous workaround (treating the file as a shell script when it's not an executable) seems to still exist to this day.
...which is exactly what you're meant to do.
This is not an example of how bad Bash it, it shows that you didn't understand what Bash is. It's expected to use various languages to write code on Linux, nobody wants you to do things in a language that wasn't made for the task.
Imagine you had to use Python on the shell and, any time you open a terminal, needed to import os and do something like print(os.path.glob("*")) instead of just opening a terminal and typing "ls" to get your directory listing. Different tools for different jobs.
Also the point they try to make about bash looking like a foreign language and having weird syntax. Yes, that's the thing: it's a very specific thing called a shell, not just any old programming language that you're meant to use for things that are not shell scripts. If Python feels more natural to you, that's probably what you should be using. Don't feel like you need to use Bash for bigger tasks than a few lines of code for no reason other than because you're on a system that has it.