5 ms·
OSH is probably a good incremental improvement over bash, but I also enjoy using the significantly more tradition-breaking Powershell with its object oriented n
by solarkraft 6y ago
OSH is probably a good incremental improvement over bash, but I also enjoy using the significantly more tradition-breaking Powershell with its object oriented nature.
It feels a lot more like programming and actually gives you useful suggestions right inside the terminal!
On Linux the auto completion behavior is luckily less obnoxious than on Windows and it doesn't have the multi second startup delay either.
- klodolph 6y agoAgreed... PowerShell is actually interesting and it feels a bit more like you're inside a shell-like REPL rather than just a fancy shell.
- 7thaccount 6y agoIt's interesting until you run up against speed limitations both left and right. I still use it for some work and enjoy it, but it is by far the slowest technology I've used.
- MaikuMori 6y agoBelieve it or not you have to disable the progress bar to speed some things up. Downloads alone are at least 10x faster if you disable progress bar.
- 7thaccount 6y agoFile read and writes are also glacially slow by all the common cmdlets. Even if you use .NET in your code and make it far more verbose it CRAWLS. Someone on here previously showed a trick to get some speedups, but it is still slow.
- chubot 6y agoI should turn this into a FAQ, but PowerShell is natural on Windows, where the OS provides objects (either via the .NET VM, or COM and .DLLs, etc.) A Unix shell like bash or Oil is natural on Unix, where the OS uses text files. And in distributed systems where data is JSON, YAML, XML, protobuf, msgpack, etc. not objects. So basically shell is a "situated" language, and the easy of accomplishing any given task depends a lot on the environment. Windows is more tightly coupled and trying to provide something nice for you. Unix is messier but doesn't limit you, and it's what basically all big systems are made of these days. A major strength of shell is to glue things together that nobody thought should be glued together. --- Good example here from Paul Bucheit: http://www.oilshell.org/blog/2020/01/simplest-explanation.html#productive-programmers-secretly-use-shell http://www.oilshell.org/blog/2020/01/simplest-explanation.ht... http://paulbuchheit.blogspot.com/2009/01/communicating-with-code.html http://paulbuchheit.blogspot.com/2009/01/communicating-with-... However, we needed a way for Gmail to make money, and Sanjeev Singh kept talking about using relevant ads, even though it was obviously a "bad idea". I remained skeptical, but thought that it might be a fun experiment, so I connected to that ads database (I assure you, random engineers can no longer do this!), copied out all of the ads+keywords, and did a little bit of sorting and filtering with some UNIX SHELL COMMANDS I then hacked up the "adult content" classifier that Matt Cutts and I had written for safe-search, linked that into the Gmail prototype, and then loaded the ads data into the classifier. My change to the classifier (which completely broke its original functionality, but this was a separate code branch) changed it from classifying pages as "adult", to classifying them according to which ad was most relevant. The resulting ad was then displayed in a little box on our Gmail prototype ui. The code was rather ugly and hackish, but more importantly, it only took a few hours to write! ---- Also, use whatever's best for you, but Unix people tend to hate PowerShell: https://medium.com/@octskyward/the-woes-of-powershell-8737e5346b1 https://medium.com/@octskyward/the-woes-of-powershell-8737e5... PowerShell feels like it was built by people who had heard about command lines a long time ago and tried to recreate one based on stories passed down through generations of their ancestors The fact that they cargo-culted operators like -eq, -le, -lt, while not maintaining compatibility is just silly to me. In Oil it's "x == y" for string equality.
- titanomachy 6y agoHadn't heard this story. Wouldn't they already have had some sort of ad relevance engine for Search?
- jayd16 6y ago> JSON, YAML, XML, protobuf, msgpack, etc. not objects. JavaScript Object Notation doesn't map well to objects?
- tick_tock_tick 6y agoNo, have you seem what kind of mish mash of a scheme most systems output? They'd be back to text processing anyway just making sure it returns the expected values.
- diroussel 6y agoAn object should have identify, state and behaviour. JSON only encodes state.
- oblio 6y agoOn the other hand, for interoperability, passing around behavior is horrible. It's either a security risk or a compatibility (forward/backward) risk or both. We should try to pass around just state and keep objects strictly for code.
- chubot 6y agoRight, I'm not really familiar with PowerShell, but my understanding is that the objects in object pipelines are literally .NET objects with methods on them. So the entire shell script is confined to the .NET VM? In that case, I would hesitate to even call it a shell in the traditional sense. Shell has a kind of code <-> data <-> code <-> data architecture, i.e. programs in different languages processing standard language-independent data formats (lines of text, JSON, HTML, QSN, etc.) It's more like functional programming, where functions stand alone. (And note Oil is in a very OO style, because it deals with significant program state, so I'm not against objects. Right tool for the right job.) ----- Other questions: What if I want to pass some data to R and plot it? Or throw away some outliers with a little formula? I now have to figure out how to serialize those objects. Or do I have to write an R interpreter for the .NET VM? :) What about splitting the pipeline over two different machines? I can do "ssh user@host find / -type f" trivially in shell. And I do this in practice, e.g. in Oil's continuous build: http://travis-ci.oilshell.org/jobs/ http://travis-ci.oilshell.org/jobs/ "Distributed objects" have proven to be a bad idea. "Real" (large scale, deployed) distributed systems are architected more like Unix than Windows. The point of shell is to integrate disparate tools, so if there are some privileged tools in the .NET VM, and then some other tools that require a lot of work to get at, then that misses the point IMO.
- wvenable 6y agoAs a software developer, not a sysadmin, I have real trouble with Powershell. They didn't tradition-break enough and it's like some bastard child of .NET and Bash. I think most people have an easier time understanding https://www.cs-script.net https://www.cs-script.net. It's powerful but the syntax and semantics are maddening. It's going to be entrenched in the Windows world for the next 20 years and prevent anything better from coming along.
- fuzzy2 6y agoYeah, I had trouble with PowerShell’s auto-magic array handling more than once. I see how it can be convenient in the REPL, but it’s just terrible when writing scripts. Your array logic returned just one element in this folder? Why, we’re unwrapping that!
- teyc 6y agoI've been using Powershell for a few years now, there are some minor warts, but those can fit in a single page. I found it rather nice for shell scripting.
- R0b0t1 6y agoI use and recommend powershell as well but only because it is best in class at interacting with Windows components. I think there are better general solutions.
- boogies 6y ago> feels a lot more like programming When I want to program a script, I can use a scripting programming language like Python with its object oriented nature. When I want to interactively command my computer I can use a shell like bash or zsh. Do one thing and do it well.
- Denvercoder9 6y agoThere's an enormous grey area in-between them though, and something that bridges that area can be insanely powerful. Making it easy to go from doing something by hand to fully automating it creates value. It's one of the main strengths of a command line interface.
- boogies 6y agoI wouldn’t call it enormous — Python can be used as an interactive shell (there’s even a toy “operating system” that uses it as the only text shell), and traditional shells can write (simpler) versions of software that’s normally made in Python https://news.ycombinator.com/item?id=23643096 https://news.ycombinator.com/item?id=23643096
- Denvercoder9 6y agoTo clarify: I didn't mean the tools, they do indeed overlap in functionality. I meant the activities you refered to, "program my computer" and "interactively command my computer".
- coldtea 6y ago>Do one thing and do it well. That's how we got in today's mess. Do the things people want in a coherent, cohesive, well thought out way - don't combine N independent programs that can barely took to each other with stringly typing and ad-hoc parsing...
- boogies 6y agoSounds like you’d prefer Python.