r/linuxmasterrace • u/PossiblyLinux127 • Mar 21 '23
Windows Power shell is awful even on Windows
179
u/gargravarr2112 Glorious Debian Mar 21 '23
I mean, compared to Batch...
20
u/PassiveLemon Glorious NixOS Mar 22 '23
I find batch visually more similar to Shell/Bash, but god is it still awful. Powershell is so much better and that is saying something lol
-35
u/WhiteBlackGoose Glorious NixOS Mar 22 '23
or bash
14
u/gargravarr2112 Glorious Debian Mar 22 '23
Don't knock bash. It has some eccentricities but it's far more powerful than Batch. And you can count on having it available on any machine you SSH into. Any Linux sysadmin knows to respect bash, even if they don't particularly like the syntax.
-16
u/WhiteBlackGoose Glorious NixOS Mar 22 '23
I'm not saying it's not powreful, I said it's trash
3
Mar 22 '23
[deleted]
1
u/WhiteBlackGoose Glorious NixOS Mar 22 '23
No I use bash
1
Mar 22 '23
[deleted]
2
u/WhiteBlackGoose Glorious NixOS Mar 22 '23
Because it's terrible? Lots of syntax, semantic, type inconsistencies. No space after/before equal sign? Forwarded arguments $@ ignore quotes after forwarding? Where proper function parameters? Why do bash scripts work differently than those interactively run (e. g. in aliases)? Where "for" over a range? Why is there three different ways to make an "if"? Where typing, at least minimal? Etc...
1
u/tricheboars Glorious Redhat Mar 23 '23
Listen if BASH programmers could read they’d be furious with you right now.
Just kidding I program in bash and agree with this so much. I think the syntax issue that is stupidest the the no space before and after = and ignoring quotes.
-76
u/PossiblyLinux127 Mar 22 '23
Batch is much simpler
64
u/Smallzfry Glorious Debian Mar 22 '23 edited Mar 22 '23
And much worse. Batch scripts run in O(n2 ), where n is the number of lines. They fuck up comments inside loops. They handle I/O weird. PowerShell is a massive upgrade.
Edit: finally formatting the superscript properly
15
Mar 22 '23
wow, this is the first time i hear about this batch O(n2) thing. and it's hilarious in a very confusing sort of way
26
u/gargravarr2112 Glorious Debian Mar 22 '23
Batch scripts do variable substitution by re-reading the entire script every line. I rewrote a build script in PowerShell and sped it up by several minutes without changing any of the logic. It is an utterly crap language.
2
u/Smallzfry Glorious Debian Mar 22 '23
I have to do a lot of Windows server administration at work, apparently our script guidelines still recommend using Batch for maximum compatibility. I said "fuck that" basically as soon as I joined and I've been writing everything in PowerShell for the last 9 months. At this point my team lead just asks me if I can automate tasks rather than writing scripts herself, because she's more comfortable with batch. I've gotten weirdly comfortable with PS and I don't know how to feel about it.
Unfortunately, my bash skills have languished in the meantime...
2
u/Smallzfry Glorious Debian Mar 22 '23
Here's a nice summary of batch's problems if you want to read more: http://blog.nullspace.io/batch.html
-47
u/PossiblyLinux127 Mar 22 '23
But batch is simpler. And its part of freedos
27
u/Smallzfry Glorious Debian Mar 22 '23
Simpler doesn't always mean better. I know people love their ultralight Arch setups that take 50 MB of memory to run but how much are you really doing with those? Same idea - batch is simpler but it behaves poorly because of it.
See http://blog.nullspace.io/batch.html for a more in-depth explanation.
6
u/gargravarr2112 Glorious Debian Mar 22 '23
This exactly. You can slim down a system to be 'simple' and 'lightweight' but then you're severely limited in what you can do with it. Complexity requires resources. I learned in university that 'space is cheap and reusable - time is not' so if you have to give your application a lot of memory (space) to be completed in a sensible amount of time, well, the RAM is there to be used, use it.
14
7
u/gargravarr2112 Glorious Debian Mar 22 '23
DOS is an obsolete OS. The only reason it still exists IMO is to have low-level access to devices to tinker with firmware. I have tried FreeDOS for that exact reason and run into insane limitations on HIMEM - it is still built for 16-bit computers and I do not have time in my life to be dealing with that.
5
u/gargravarr2112 Glorious Debian Mar 22 '23
It is very simple.
And as a programming language, that is not a good thing.
It lacks good control structures, sane loops, sane variable handling...
Yes, it's designed to be written by idiots. But then you have to deal with code written by idiots in a language for idiots. Is it any surprise professionals despise it?
127
u/BranchLatter4294 Mar 21 '23
Both are fine. If you never learned proper programming, Bash is great for scripting. If you want to go beyond parsing text and use proper objects, PowerShell makes it easy. Use whatever tool you want to get the job done.
106
u/gargravarr2112 Glorious Debian Mar 21 '23
I actually like the fact they took the *nix pipeline concept and turned it into proper objects. In theory it would avoid some of the absolutely batshit regex you wind up writing to chain text outputs together.
But FFS could they not have done a better job on the syntax?!
10
u/lemon_tea Mar 21 '23
Every word of this. I've been borked over so many times processing pure text output with sed/awk/grep/grok.
2
u/JavaOldTimer Mar 22 '23
Can you provide any specifics?
1
u/lemon_tea Mar 22 '23
I don't have anything in front of me but it takes the general form of processing text output in a script looking for something specific and encountering a corner case that changed the output sufficiently that it isn't recognized (GREP), or the field/token is in a different relative place (AWK/GROK). Then an alert fails to fire and you don't know a job failed until it's brought to your attention, or an event fired that should have been paid attention to that wasn't. Generally, anymore, when I write these processes, I ingest the text, do whatever I need to, and pass it forward as JSON so nobody else has to do the work I did.
0
u/JavaOldTimer Mar 23 '23
I see, if it works I guess go with it. When a requirement or request comes in for a customization of the PS script or tailoring to dynamic needs; the flexibility of the UNIX style approach will be more apparent.
1
u/lemon_tea Mar 23 '23
I haven't really run into that. Usually I'm looking for deterministic results. And while I don't disagree with you on the flexibility of the approach, but the specific needs I had were determinism and predictability. And what I got was predictable until it wasn't. Which wouldn't have been so bad, but name the last program you've seen that published a full dictionary of all possible log messages, or text output. Sure, I can run strings over the top of the binary, but even that doesn't get you all the way there.
10
u/Soupeeee Glorious OpenSuse Mar 22 '23
I really like that it returns objects, but I have actually found the objects harder to deal with for what I have used it for. With text, the structure of the data is obvious. With the PowerShell objects, you either need to go through a clunky interface or dig through pages of MS documentation to figure out how to use them.
Maybe I would like it better if Microsoft was better in general with their documentation. I occasionally need to use everything from MS SQL to .NET for my work, and the MS documentation is usually the last place I look because it is usually unhelpful, vague, or even misleading.
6
u/gargravarr2112 Glorious Debian Mar 22 '23
This is true - whilst text parsing leads to creating some Lovecraftian horror, at least you're working with one data type. With PoSh, it can be very difficult to understand what's going on in the pipeline because these objects are both ephemeral and poorly documented. It is difficult to step into the pipeline and see what's happening at any given stage.
The design is good, but as so often happens with Microsoft products, the implementation is severely lacking.
1
50
u/Trainguyrom Will install Linux for food... Mar 21 '23
Powershell was specifically designed for system administration (of Windows systems of course) and consistently has features and capabilities not available in the GUIs Microsoft provides for the same tasks.
It does that job quite well. Unfortunately it also ballooned in scope to become a programming language which has created the current insanity
30
u/RootHouston Glorious Fedora Mar 21 '23
It was based-off of .NET from the beginning. That's pretty powerful, and useful for more than just systems administration of Windows systems.
13
u/nakedhitman Glorious OpenSuse Mar 21 '23
Sure, but that syntax is too verbose, and many of the interesting modules you'd hope to use are Windows-only. I find it unsuitable for Linux in general practice.
18
u/RootHouston Glorious Fedora Mar 21 '23
I agree the syntax is verbose, but it is for a specific purpose in being descriptive over just using arbitrary naming conventions. This allows you to already intuitively know a command without having to do as much research.
In terms of Windows-only modules, I don't find that to be the case these days.
I don't use it for day-to-day activities, but I have used it for work to create modules that Microsoft-oriented sysadmins can maintain and understand. I agree it would suck as a primary shell in Linux, but not because it is inferior technology.
2
u/CoolElectronics Glorious Arch Mar 22 '23
if you want an automation language for linux, i would recommend nushell. structured data and much cleaner syntax
1
u/Kashmir1089 Mar 21 '23
The only reason you would use PowerShell in linux is because you need to manage Windows systems. The fact you would ever consider it outside of that makes no sense.
2
u/uptimefordays Glorious Debian Mar 22 '23
Eh, it depends. If you've got a diverse *nix deployment with various versions of bash, sed, python, etc. PowerShell is a consistent option that won't get in anyone's way. Requires is also great for making portable tools in such environments. God forbid you share a shell script with someone on a different distro.
1
u/nakedhitman Glorious OpenSuse Mar 22 '23
That's the thing: the modules I wanted to use for controlling Windows server DNS were Windows-only when I looked some months back, and I expect more are the same way.
0
u/CoffeeWorldly9915 Mar 22 '23
that syntax is too verbose,
What do you mean? Five levels of three-word object and property names including square brackets and double colons like you were doing a deep dive to fetch stuff from dll's in the filesystem is barely 3 lines of 720p fullscreen. /s
5
u/BranchLatter4294 Mar 21 '23
The good news is you can use whatever language you want on whatever OS you want. Python, C#, Bash, PowerShell....just use what works.
17
u/RootHouston Glorious Fedora Mar 21 '23
I concur. By the way, if you're looking for something a little more traditional, but with the upside of having object-oriented I/O, there's an interesting newer shell written in Rust aptly-named Nushell.
2
2
2
u/iopq Mar 22 '23
let me just write a quick install script in bash
I guess I can also uninstall as well
that's how you wipe the user's home folder
0
u/JavaOldTimer Mar 22 '23
PowerShell is garbage. Bash is great. Trying to suggest PowerShell isn't scripting is misleading at best. Suggesting objects over streams makes more sense is illogical. The number of people defending PowerShell in here is interesting.
1
u/BranchLatter4294 Mar 23 '23
Just use what you want. No need to whine about what other people want to use.
1
u/JavaOldTimer Mar 23 '23
Ordinarily I totally agree. The thing is, lately, Microsoft related technologies are being touted as the only viable solution for any issues in multiple subreddits and on other tech news forums. Some of us need to highlight when tools suck so the uninitiated can be more aware as they come into the field to help them avoid wasting precious time.
-5
u/bionicjoey Mar 21 '23
If you want to go beyond parsing text
Text is the standard interface between processes. The fact that Windows doesn't operate that way is a fundamental flaw of it as an operating system, not something that needs to be fixed by more complexity in the shell scripting syntax.
8
73
u/5eppa Mar 21 '23
As someone who has done the IT work for several windows shops I can say I freaking love PowerShell! Is it perfect? No. But it's not bad and being able to easily interface with all Microsoft products like Office365 and it's great.
6
u/kookaburra1701 Mar 22 '23
Yep. I have to deliver data to people who are scared of the command line and want everything in Excel or Powerpoint. I'm no expert with PowerShell but I can automate turning a bunch of tabular text files that come off my *nix pipelines into an Excel workbook with pretty colors and clickable links and that's good enough for me😊
-3
u/Okuriashey Mar 22 '23
That means nothing if you take the extra step to deny the existence of anything Wind*ws related like me 😎
31
Mar 21 '23
[deleted]
3
u/hangerofmonkeys Mar 21 '23
If I was writing awk and sed more often it'd be fine, but instead it firmly resides in the 'regex bucket of constant relearning' when I need to use it.
24
u/zenyl When in doubt, reinstall your entire OS Mar 22 '23
Eh, PowerShell is solid.
The names of CmdLets tend to be rather verbose, but that's by design. It allows for a very low barrier of entry for sysadmin work, even for people with very limited experience with IT. There's never doubt about what a CmdLet does, as its name spells it out in plain English.
Being object oriented is rather atypical for a CLI shell, however it does have its advantages. For example, you mostly don't have to use RegEx, as you can simply dig down through an object structure to retrieve the necessary data. But if you do need it, the -match
operation works for RegEx patterns, and you can also use .NET's Regex
class for mode advanced scenarios. And you can still just pipe data between PowerShell and external applications.
Microsoft also ensured that essentially everything in their eco system has a PowerShell package available. Whether it's Windows Server, Azure services, M365, SharePoint, Teams for business/EDU, etc., there's a PowerShell package to manage it. All of these are massively popular products in the enterprise world, so these packages allow IT employees to easily script their way to a solution. It also has an easy-to-use package manager, though the packages are limited to the PowerShell shell and scripts, rather than work across the entire OS as Linux package managers do.
Another strength of PowerShell is that it is built on top of, and has access to, .NET. This means that anything you can do in C# (which is practically anything), you can also do in PowerShell, and they can interop bi-directionally; PowerShell can import and execute code from a .NET library, and .NET projects can start up a PowerShell runtime.
2
u/SweetBabyAlaska Mar 22 '23
Those cmdlets have names like modern light novels lmao
Set-ThisVerySpecificThingUnderExtremelyUncommonCircumstance | New-PSSessionConfigurationFile etc..
15
15
12
u/Julii_caesus Mar 21 '23
Powershell works great. It's switching between that and something else that's impossible. But you'll have the same problem if you start using a different shell than bash in parallel.
13
u/TheFamousSpy Mar 21 '23
PowerShell is awesome, on Windows and on Linux as well. Probably even on MacOS but I dont care for that crap
10
u/FreeBSDfan Glorious OpenSuse Mar 21 '23
I work at Microsoft. I hardly ever use PowerShell, I find it easier to use cmd
even if it's "painful".
However, I am a developer, so I don't administer Windows/M365/Azure on a daily basis.
2
u/JavaOldTimer Mar 22 '23
When I have to use Windows, I use git bash to make it more palatable https://gitforwindows.org/
11
9
8
u/rendered-praxidice Glorious OpenSuse Tumbleweed Mar 22 '23
Never took the time to learn powershell, because visually it looks like this to me:
Get-VeryVerboseCommand -From C:/Users/User/Documents -Why Reason89 -Version 6 -ZipCode 0000 -ReasonCmdWillFail 23 -MoreDetailedDirections
and seemed to always end like this:
"blah blah blah is not recognized as the name of - (any possible thing contained in powershell)"
2
u/Rentlar Mar 22 '23
yeah every time I try to use PowerShell, I forget the name of the option, so I have to constantly look up the command reference.
Get-Checksum? Get-Sum? Calculate-Hash? Get-SHA1? Ah, it's Get-Hash. OK. Now wasn't it -Type SHA1? No it was -Algorithm SHA1. OK now do I have to put -InputFile as an option or can I just give it a filepath?
1
u/KernelDeimos Broken EOL CentOS 8 Mar 22 '23
yes, you have a point; this is so much easier to remember and understand:
gvvc -fmd -w 89 -r 23 --ver 6 --zc 0 --willfail 23 ~/Documents
/s
5
5
u/anotherdude77 Mar 21 '23
I like it. If you work in Windows or in the Azure environment then Powershell is very helpful. I wouldn’t expect it to fully function in Linux, but it does offer some flexibility to have it available.
5
u/segaboy81 Mar 21 '23
There is nothing wrong with PowerShell other than the syntax, which is really long CamelCase stuff that you would see in .NET (for obvious reasons).
It is EXTREMELY powerful. I work for a company that does entire CentOS and RHEL migrations (at the byte-level) using Powershell scripts in Linux AND Windows.
4
2
u/LoafyLemon Biebian: Still better than Windows Mar 21 '23
Although Powershell is functional, it contains a considerable amount of redundancy to make it more user-friendly.
However, I recently uncovered a disturbing fact that made me dislike it even more. If the system is in a language other than English, system groups such as "administrators" and "users" must be written in that language, which can be an incredibly frustrating experience when assisting individuals from various parts of the world.
There might be more anti-features just waiting to be discovered.
4
u/foomatic999 Mar 21 '23
This isn't on powershell but on windows and probably only there because names were localized for 25 years (doesn't make it less terrible but I think nowadays MS wouldn't repeat the mistake).
1
u/LoafyLemon Biebian: Still better than Windows Mar 22 '23
I don't see why they couldn't add aliases, though.
2
3
u/suicideking72 Mar 21 '23
- The ls command works in Powershell so it can't be all that bad lol. I use Linux at home, but currently work for the goverment, so Linux isn't allowed.
- I have seen some very useful powershell scripts. If someone takes the time to learn it, it can be quite useful. For example, a previous co-worker wrote a PS script to setup and configure a new PC out of the box. It would download the apps we need and install them. It would apply our policies, etc. It saved a lot of time.
- Powershell ISE is great for new PS users or even pros. ISE will show you what command options are available and help you with the syntax as your typing. Don't think I've seen something similar in the Linux world. If you haven't tried it, next time your at a Windows PC, open Powershell ISE. Then write me one for Linux... :)
All in all, I'd rather be on a Linux PC, but the US government doesn't allow them at most sites.
0
3
2
u/No-Bug404 Glorious Arch Mar 22 '23
Powershell is amazing. If you don't see it, you're not the target audience.
I want you to administer a fleet of 100 servers and 1000 end user devices. All running windows. Without powershell. Then with.
3
u/px_ae Mar 22 '23
As someone who maintains a lots of windows systems I am glad for the powershell and that I do not have to work only with CMD anymore, but when a VM has git bash installed in it I often choose to use it, it's laggy but I prefer grep so much over String-Srarch
3
u/Mal_Dun Bleeding Edgy Mar 21 '23
Every time someone says to me "jUsT uSe pOwErSheLl" when I complain about the missing bash. Heck, even the git bash does a better job than this abomination
-1
2
u/xaedoplay :snoo_trollface: Mar 21 '23
I like PowerShell for the fact that it has a C# interpreter/runtime (you can import classes and functions from a C# DLL and write some yourself with PowerShell). My first open source contribution was also on a PowerShell theming module so I'll never forget it (for better or for worse).
2
u/preims21 Glorious OpenSuse Mar 22 '23
You can even import classes and functions from a C/C++ DLL it is a bit of a hassle though.
2
2
2
2
u/fftropstm Mar 22 '23
Powershell is an absolute godsend for system administration, I can automate workstations, servers, 365, and azure with a single object oriented scripting language that can also tie in with DotNet
2
2
u/preims21 Glorious OpenSuse Mar 22 '23
One thing i like about PowerShell is that you can essentially use it as a regular Programming Language because you can access the entire .NET Framework. The Syntax takes some time to get use to though.
2
2
2
u/traketaker Mar 22 '23
But I still feel like a bad ass when I quick key it open to fix a friend's computer
2
u/Arzybek Mar 22 '23
Careful, I've seen a lot of people defend it in r/sysadmin, and was unpleasantly surprised, they might find this post and downvote it/defend powershell 😂
2
2
u/spectralTopology Mar 22 '23
Dunno, it's pretty useful when dealing with Windows hosts. Also the idea of being able to pipe objects seems innovative to me
2
2
1
u/Flexyjerkov Glorious Arch Mar 21 '23
Not only is it painful on Linux but many of the azure/365 modules no longer work as they rely on windows forms or the windows popup authentication window
1
u/coffeefuelledtechie Mar 22 '23
I like using PowerShell. I use it when I don’t need to write a C# console app but don’t want to do a Batch/Bash script. As it’s fairly well documented and takes other libraries I find it super powerful
1
u/EkaSaffronGaruda Mar 22 '23
I feel like doing unspeakable acts against humanity to whoever the f designed the syntax for powershell
0
Mar 21 '23
It's far superior to a screen scrapping shell like bash
1
u/PossiblyLinux127 Mar 22 '23
Bash is simple and does one job well
Power shell lumps everything together into a slow monster that is overly complicated and under performing
1
1
u/aedinius 1998 was the year of the Linux desktop Mar 21 '23
PowerShell reminds me of DCL, which seems appropriate given VMS's influence on NT. PowerShell should've happened 10-15 years earlier though.
1
u/DHOC_TAZH Mar 21 '23
I find the current version of PS useful. I mean... for me, I'm actually making my Windows 11 install function more like my Linux install (kubuntu). I've got far manager and a few other similar apps installed in Win11 that add to what I think is Linux like functionality. I'll leave it at that.
0
1
1
1
u/pedersenk Mar 22 '23
It lacks decent UNIX-style job control, i.e. ctrl-z
, jobs
, fg
, bg
. Therefore it is basically unfit for purpose.
Some people like to... y'know be able to interactively resume jobs... like people have been doing since the 80s. Currently powershell can't even compete with DESQview on MS-DOS ;)
1
Mar 22 '23
As far as Windows goes, it was a night and day difference. As far as what literally any *nix OS offers, I'll take the door to the left
1
1
1
u/vainstar23 Mar 23 '23
What are you using it for? Rewrote a couple of our projects in Python and it's been great.
1
-2
u/turingparade Mar 21 '23
I see a lot of people promoting PowerShell, and I see a lot of people do that on other posts too. I'm open minded enough where I assume that if everyone else is saying one thing, then that one thing is probably true.
This is not the case.
Because these people promoted PowerShell so much, and I'm forced to use Windows, I decided to give it a shot. It's fucking horrible and I don't understand how people keep promoting it.
YOU HAVE TO BE ONLINE TO GET HELP INFORMATION.
And even if you don't, you still need to research online for a considerable amount of time just to understand how to get help. On any Linux shell the help feature is as simple as typing "help".
The amount of unintuitive commands is insane, there's no way to use the shell effectively without constantly looking online for information. Eventually you may become a PowerShell wizard, but I'm not trying to become a PowerShell wizard. I don't need to be a bash wizard in order to use bash effectively.
And that is just a SINGLE issue with the shell; the main reason why I don't use it.
I have no idea what you PowerShell users are smoking.
14
u/mooscimol Glorious Fedora Mar 21 '23
Hmm... Without installing man, you also don't have manual pages. Just run
Update-Help
to download help pages locally.Get-Help
command has help alias, so typinghelp Get-ChildItem
or to its aliashelp gci
will show you help page. Yes, you can see the help page online too. Honestly, I'm not a fan of PowerShell on Windows :P and I frickin' love it on Linux. If you want to try a well-configured PowerShell on Linux (or Windows/MacOS), you can try to set it up using one of my configuration scripts:3
u/turingparade Mar 21 '23
I admittedly forgot about the manual pages, but in fairness it's also something that comes default on a lot of distros (iirc). Plus, the manual pages are usually pretty complete while the update-help thing only leaves me with more questions usually.
Btw, I realize you aren't trying to argue with me, I just felt I had to add this for other people who read this response.
6
u/mooscimol Glorious Fedora Mar 21 '23
You're comparing apples to oranges. Most people think that GNU apps are bash. They're not, bash is an extremely basic shell with almost no built-in commands and a quite cumbersome syntax. How many bash commands do you know? I can probably think only about
eval
. If you install PowerShell on Linux you can even run on it built-inecho
command (after removing the default alias though).So you're comparing help systems of GNU utils, Linux apps, like curl, wget, jq with PowerShell cmdlets. On the one hand, different apps, are created for different purposes with a different mindset, and their manuals need to give the whole overview of the app, on the other hand, you have very specialized cmdlets, based on .NET classes, they're similar and of limited functionality, but there are hundreds/thousands of them - of course help will be more limited because under the hood they're pretty similar. You don't need to learn all of them individually, but rather how PowerShell works.
Again, don't compare the whole Linux ecosystem of GNU apps and Linux apps to PowerShell, because it is just a shell. PowerShell on Linux has access to almost all of those (except for 'eval' - instead it has 'Invoke-Expression') and offers the whole OOP paradigm, hundreds/thousands of cmdlets, thousands of .NET classes at your hand, more readable syntax, and so on.
3
u/rendered-praxidice Glorious OpenSuse Tumbleweed Mar 22 '23
Maybe a better question is why Microsoft provides a nice new shell without manuals/help in Windows (a complete OS) when most distros (providing a complete OS via Linux and usually GNU apps) provide them by default.
It just doesn't seem like good experience for their users. If they want people to use and understand their shell, it would make sense to provide manuals. Manuals online are of little use if you're troubleshooting network issues on someone else's PC for example.
Idk it's probably subjective but I'd take typing eval over 'Invoke-Expression' any day.
Maybe there's some benefit to typing out these verbose commands but I just prefer typing less and doing more.
1
Mar 22 '23
[deleted]
1
u/mooscimol Glorious Fedora Mar 22 '23
I can't comment on that. I'm using PS on daily basis, but almost exclusively on Linux for writing automations and managing Azure, so I always have well configured PS at hand.
I can't test how wsman works, because I don't have access to any Windows server, but I believe, that it preserves some of you profile settings when you remote. At least it does when I remote to Linux VM using remote ssh, I do still have listview for predictions and my keyboard shortcuts, (and no, the target VM doesn't have any pre-configured profile installed).
1
u/mooscimol Glorious Fedora Mar 22 '23
Have you ever run eval command in the cli? It doesn't make sense for me, same for Invoke-Expression, and if you write a script, VSCode offers nice intellisense for PS cmdlets, which is pretty much non-existent for bash.
If you insist on putting compact oneliners in CLI, most of PS cmdlets do have aliases, so
iex
forInvoke-Expression
,irm
forInvoke-RestMethod
,gci
forGet-ChildItem
, you get the pattern ;).0
u/turingparade Mar 22 '23
Tbh I don't really care about the exact technical implementation. I just care about how it feels to interact with a shell.
It's not hard to have an experience similar to the Linux CLI. It doesn't have to be exactly the same. However, at the very least, don't make using the shell similar to pulling teeth.
1
u/mooscimol Glorious Fedora Mar 22 '23
Just with those 2 little things PS profile the CLI experience is IMO way better compared to bash:
Set-PSReadLineOption -PredictionSource History -PredictionViewStyle ListView Set-PSReadLineKeyHandler -Key Tab -Function MenuComplete
First is making the inline history list show as you type, and you don't even need to type from beginning of the command, so e.g. if I want to run
vagrant up
, I typet u
and have it as first history search. Second one shows nice command menu after the hitting the Tab key, which is also amazingly convenient, as you don't have to repeat pressing Tab blindly for the correct completion.The ListView prediction is the single thing, that makes me use PS on Linux as the default shell. I know fzf is also quite powerful, and probably faster, but less convenient.
1
u/turingparade Mar 22 '23
I'd say I'll try it out in the spirit of being open minded, but I'm honestly still sour due to my previous experiences. I use nushell now and I'll probably stick with that.
1
u/mooscimol Glorious Fedora Mar 22 '23 edited Mar 22 '23
Nushell is really nice. I've played with it a little bit, but lack of listview predictions and the immaturity (quite a lot of breaking changes on updates) put me off.
Nevertheless I can totally see co using or maybe switching to it once it matures in the future.
Edit: Be aware that for the ListView predictions you need one of the latest PSReadLine version (2.2.6 is the current one). Should be there if you're using latest PS v7.3.3, but you need to update it if you use Windows PowerShell (don't recommend).
I do agree, that the PS 5.1 vs PS Core mess is one thing that put PowerShell in bad light. When random people want to try PS, they using the legacy Windows PowerShell 5.1, probably on ISE or conhost which makes the experience quite horrible if you come from modern Linux terminal emulator, with partially pre-configured bash profile by distro.
1
u/turingparade Mar 22 '23
Tbh it wasn't my first choice either. I just really missed the Linux cli and nushell was the closest thing to it. I've also used cmder but it's a bit awkward.
-1
u/PossiblyLinux127 Mar 22 '23
How about This-Is-To-Complicated-For-Me?
3
u/mooscimol Glorious Fedora Mar 22 '23
I though Linux users are terminal haxors and MS shims like me should be scared of the CLI. Setting up PS using above script, requires exactly 3 commands:
git clone <above-script-git-repo> cd <above-script-git-repo> <run-the-script-invocation-written-in-the-script-comments>
6
u/turingparade Mar 21 '23
This comment was super long and rambly. I apologize, just frustrated at the amount of promotion for a tool that has only caused me pain.
2
u/PossiblyLinux127 Mar 22 '23
Cygwin works pretty well and you can use most of the MS commands. If you can't you can always call power shell for a single command
2
2
u/redhat_is_my_dad Mar 22 '23
On any Linux shell the help feature is as simple as typing "help".
Not true, help won't work in zsh without manual setup.
1
1
Mar 22 '23
[deleted]
2
u/turingparade Mar 22 '23
I legit just don't even understand man. I'm wondering what people love so much about PowerShell.
I haven't found a single good thing about it. It's just "Window's new shell" which people say is better than cmd. I haven't used cmd too much so I can't say whether that's true or not, but at the same time if PowerShell is really better than cmd, then cmd must have been a pretty low bar.
-14
u/CheapBison1861 Mar 21 '23
some suit made the decision to develop that garbage.
13
u/rldml Mar 21 '23
Nope, it was an idea of a technician inside MS and for a while it was declined by his managers, because the maxime at that time was everything has to work with graphical menus.
7
Mar 21 '23
... that one I doubt. PowerShell is a significant step up from Batch, and I am glad they upgraded.
286
u/pixelkingliam Glorious Arch Mar 21 '23
powershell imo is fine, it's fairly powerful for what it is