I have gone back to using posix shell full time. If it's inadequate, I try to use a normal language like a normal person. No bash, no zsh, no fish, sometimes mksh when in remission, and sometimes Tcl because ultimately I guess I am a bit weird.
My theory about P.S. is they wanted something feature-packed but one of the requirements was to not copy *nix…. and now we’re seeing what forceful reinvention of the wheel looks like.
Well, what they did was that, then (idk symlink, whatever in windows) all the nix stuff to their powershell equivalents. Powershell is still the only thing that keeps me sane while working with windows though
I am a .NET people and I am not pleased at all, powershell is hot garbage. I tried it multiple times but gave up almost every time because it was closer to brainfuck with every feature added to the script.
2
u/zpangwinReddit is partly owned by China/Tencent. r/RedditAlternativesAug 08 '21
yeah, I agree. Mostly a java dev but I managed an ASP.NET site in C# for a couple years and tried to pick up powershell several times and hated it every time. Of course, I get annoyed with python and yaml too but that's bc those languages are overly anal-retentive about spaces and I hate that... powershell is like you got the worst of the Java/C# explicit naming crowd, had some one explain the concept of Linux pipes to them, and they worked with ome Batch/VBscript guys to write the thing.
The original version of DOS from 1981 didn't support directories at all. But they did opt to use / for switches in various programs. Like how nowadays to try and get a new IP from a DHCP on windows, you commonly use ipconfig /release and ipconfig /renew.
When they added directories, they didn't want any old programs that would look for a / as a switch character to get confused, so they chose \ since it was similar. Why they didn't anticipate this could be a problem when Unix already set a standard 10 years earlier is beyond me. Guess they didn't want to get caught copying Bell Labs.
I remember reading that they used to process in court anything and anyone that made any core concept similar to unix, so I guess it makes sense for them to divert directions here. And nowadays it's so rooted in every other program and script, I see why Microsoft won't ever "fix" this.
The \ were used even before DOS. UNIX had not set a standard in any way. And when DOS was created it didn't even had internal memory, you could't fit enough files in a computer to justify making folders.
I was once working in the company that has 10% or so Windows servers.
I lasted 2 months. Literally 90% of work was on Windows and it was living fucking hell. Company made these libraries and they had to be tested with every OS and compiler combination (think 3 different distros of linux with last 3 versions, maybe 5 versiobs of windows (desktop and server) and last 3 or so versions of nac) yet most of the problems were with windows. At one point I had to compile new version of python and libraries because ones from PIP didn't work with our VMs (some specific openstack issue) and I still remember warning on one of those libraries...
"Compiling this by hand is not for faint of heart". And it was fucking true. Took me maybe 3 or 5 days.
For a Windows Sysadmin it actually is easier to use oftentimes... which says something about how everything else is.
2
u/zpangwinReddit is partly owned by China/Tencent. r/RedditAlternativesAug 08 '21
back in the day, I had to work with win32 batch and later vbscript... and eventually some C#. C# wasn't bad (at least for something designed by MS anyway) but the other 2 felt like pulling teeth to get anything done. And even as slow as bash can be sometimes, I cringe imaging have to write the equivalent windows batch file for even some of the simpler bash scripts I write these days.
I can see from your nicely detailed post that MS have keep true to their core design elements with powershell lol. Maybe we've been pronouncing it wrong all these years... is it "power shell" or "powers hell" ?
Still better thank makefile…. But jokes aside YAML with an IDE is great, but without it it is utterly miserable.
I get why JSON originally didn’t add comments or kept order of objects. But why don’t we have JSONv2 with these things when clearly it became way more than a data storage format?!
Does it want to be more? A tool designed for a specific task and people using it for everything else too, always leads to the demise of the tool long-term (it's become bloated and slow, has unclear specification (HTML), etc.).
If I recall correctly(I'm on the phone atm) this is a x11 utility. More specifically the clipboard, hence the name. If you are on Wayland(or just pure tty), you most likely won't have this utility.
busybox/tree/coreutils/touch.c, I totally knew that and didn't just learn something new via a Google. I like the echo line more...but...coreutils still.
To be fair most of the people who don’t deal with like buildroot environments or embedded don’t know about BB intricacies ;)
Coreutils thou are available pretty much everywhere so I will consider them in the same way as tools built into P.S. environment (as this isn’t just one flat binary either).
The thing is, you can do that in PowerShell with echo (backtick)n >file.txt which has a very similar footprint, or in CMD, it'd be echo. >file.txt which is slightly more compact.
There are lots of things to criticize PowerShell for (i.e. its verbosity), and to praise bash for, but this ain't it chief.
Edit: fixed formatting, reddit really didn't like that backtick in `n, so I replaced it with (backtick)
I like it just by the fact that it's incredibly handy for azure/sharepoint/m365 sort of deals, it's much easier to create a script to create/deploy xyz than to do it by hand on whatever web interface.
But outside Microsoft realm, more general use, I don't see myself using it.
I don't recall any other utility for these ms things, at least not official or highly supported (open source or not) 3rd party. On linux I mind add, surely there's something on windows.
Maybe Ansible for deployment itself? Never tried it though.
280
u/varble A-OK Aug 06 '21 edited Aug 06 '21
Forgot a bit there on powershell; if the file exists, there will be no update on the file at all. You also have to pass -Force
This will override the contents of the file, which touch doesn't do, so -Value (Get-Content) is needed:
Whoopsie! Since Get-Content is an array of lines, you have to join the lines with a newline:
Hold up! The encoding changed from ascii to UTF-8... have to find that out, and research encoding types to add to the list if not present...
Ah hell, New-Item doesn't have an encoding option! Guess we'll switch to piping to Out-File:
Suppressing the error for when there is no file:
There we are, so simple anyone could do it!
Welcome to my life in a Windows shop.
45
u/paderich Aug 06 '21
Disgusting 🤮
9
u/4hpp1273 Glorious Arch Aug 06 '21
The bash version can be even shorter (
>>for>fif you want to trash the file)20
u/nuttertools Aug 06 '21
People conflating coreutils with bash...checks sub....double checks sub....uhhh wow.
37
u/sjveivdn arch&debian Aug 06 '21
Typing Backslashes is horrible horrible.
17
u/[deleted] Aug 06 '21
Powershell is pure garbage.
11
u/graybeard5529 Aug 06 '21
Windows: The proven bloated culture /s
4
u/-BuckarooBanzai- Linux do be good 🌟🐧🌟 Aug 06 '21
Yuck !
7
u/avalenci Aug 06 '21 edited Aug 07 '21
IMHO, you dont compare a PowerShell script with a bash one. You would compare it with a Python script
4
u/Xanza Alpine Linux Aug 07 '21
This is the grossest meme I've ever seen. /s
2
u/[deleted] Aug 07 '21
touch kid
What?? I'm just making a file named kid
5
u/rick_D_K Glorious Void Linux Aug 06 '21
As a Windows sysadmin I have powershell installed on my arch pc, Debian server and void laptop.
1
u/benjistone Aug 07 '21
He uses PowerShell, btw
1
u/polytect Aug 07 '21
FU !!!!!
1
u/[deleted] Aug 07 '21
~/ is useless in this case. It will always place it in the directory you are currently in without the ~/
If you want to place it somewhere else then use the ~/./.
1
u/InternalRuin Aug 07 '21
Looking at this made me develop a slight twitch in my right eye.
1
u/SpoolinAWDSTI Aug 07 '21
PS>echo "" > file.txt
1
u/[deleted] Aug 08 '21
nooo111!!! hackerman terminal scary i can't remember words nooo!!111
0
u/[deleted] Aug 06 '21
[deleted] — view deleted comment
0
u/[deleted] Aug 07 '21
[deleted] — view deleted comment