5 ms·
It's interesting that they're actively promoting using it with a shebang. I find it pretty appealing. Go prior to modules worked really well this way and I bel
by donatj 1y ago
It's interesting that they're actively promoting using it with a shebang. I find it pretty appealing.
Go prior to modules worked really well this way and I believe Ubuntu was using it like this, but the Go authors came out against using it as a scripting language like this.
- flmontpetit 1y agoI used to work for a .NET shop that randomly wrote some automation scripts in bash. The expertise to maintain them long term (and frankly, write them half-decently to begin with) simply wasn't there. Never understood why they didn't just write their tooling in C#. Maybe this will make it seem like a more viable approach.
- psyclobe 1y agoBash is the tool that’s already there; that is always a real good reason to use it. Dotnet is a pig with its dependencies by comparison.
- dragonwriter 1y ago> Bash is the tool that’s already there; that is always a real good reason to use it. If you are a dotnet dev shop, it is quite likely that dotnet is also a tool that is already there the places you need automation. Plus, its also the tool that is already there in your team’s skillset.
- senthil_rajasek 1y agoI am an old hat. I've been in dotnet dev land for decades and still use bash (git bash). Pros: Syntax + access to familiar shell commands Cons: Bash scripts are not easy to maintain.
- gofreddygo 1y agoNot an old hat. in the dotnet world for 3 years, bash over a decade. Agree with bash not being easy to maintain. Argument about bash being always there breaks down quickly. Even if you limit yourself to bash+awk+grep, they dont work consistently across different bash flavors or across platforms (mac/win/linuz). My approach now is to have my programs, in the language most convenient to me, compiled to a bunch of archs and have that run across systems. One time pain, reduces over time.
- const_cast 1y ago> Argument about bash being always there breaks down quickly. Even if you limit yourself to bash+awk+grep, they dont work consistently across different bash flavors or across platforms IMO this is why Perl was invented and you should just use Perl. Bash isn't portable and isn't very safe either. If you're only going to use a couple of commands, there's really no reason to use bash. The usecase, in my head, for bash is using a variety of unix utils. But then those utils aren't portable. Perl is really great here because it's available on pretty much every computer on Earth and is consistent.
- spauldo 1y agoExcept Windows, of course. You can install it there but it's plainly obvious it's in a foreign environment. A lot of people focus on Perl's bad reputation as one of the first web languages instead of its actual purpose, a better sh/awk/sed. If you're writing shell scripts Perl's a godsend for anything complex.
- jmull 1y agoThere's still version/dependency hell (one thing wants 6, one thing wants 8, one thing wants 8.1, etc.). This can be managed but you have to manage it. (A fanatical commitment to backwards compatibility can make this a lot easier, but it doesn't seem to me that dotnet has that.)
- jinushaun 1y agoI worked at a dotnet shop a few years ago back. We still used bash over powershell unless we required COM
- jayd16 1y agoIts trivial to install a consistent PowerShell environment on the major OSes. Not so for Bash.
- spauldo 1y agoIf you write to POSIX it's a lot more portable. If you're doing something outside POSIX, it's probably best to use something else, like Perl.
- jayd16 1y ago...Or powershell! Besides, the trick is knowing what is POSIX compliant and portable, and what isn't. A lot of things will almost work.
- spauldo 1y agoKnowing stuff is what we're paid for, otherwise we'd all be making minimum wage. Besides, there are plenty of non-bash shell scripting resources out there, which is good to learn if you want to work with the BSDs or proprietary UNIX systems. Powershell on UNIX is like Perl on Windows. It works, but it's weird and alien. But the same can be said for .NET, really.
- Ray20 1y ago>Dotnet is a pig with its dependencies by comparison. Dotnet with all dependencies you will get in how much time? In like 6 minutes including all the preparations? So the difference between "already there" and dotnet - is 6 minutes. It's hard to imagine a case where this difference matters.
- crote 1y agoSure, but these days so is Python. And you've got a dozen other languages available after a single command. You wouldn't recommend using a kitchen knife instead of a chainsaw to cut down a tree just because it's already there, would you? Bash has a huge number of footguns, and a rather unusual syntax. It's not a language where you can safely let a junior developer tweak something in a script and expect it to go well. Using a linter like ShellCheck is essentially a hard requirement. If you're working in a team where 99.9% of the code you're maintaining is C#, having a handful of load-bearing Bash scripts lying around is probably a Really Bad Idea. Just convert it to C# as well and save everyone a lot of trouble.
- CoolCold 1y ago> Bash has a huge number of footguns, and a rather unusual syntax. It's not a language where you can safely let a junior developer tweak something in a script and expect it to go well. I'd say as someone who started with shell/bash in ~ 2000 to cater Linux systems, it's quote usual syntax and I believe that's true for many sysadmins. No way I'd like to deal with opaque .Net or even Go stuff - incapable of doing "bash -x script.sh" while debugging production systems at 3AM. And non production as well - just loosing my time (and team time) on unusual syntax, getting familiar with nuget and ensuring internet access for that repos and pinging ITSec guys to open access to that repos. > let a junior developer tweak something in a script and expect it to go well let developers do their job, writing bash scripts is something extraordinary for dev team to do, just because - where they expected to apply it? I can imagine "lonely dev startups" situations only, where it may be reasonably needed
- JamesSwift 1y agoOr just use powershell. It has some idiosyncrasies but its a pretty nice platform for scripting
- moomin 1y agoHere’s the really annoying thing with powershell: it doesn’t have a module distribution model. Like, at all. A csharp script, on the other hand, gets NuGet out of the box.
- accoil 1y agoWhat is the PowerShellGet module[1] missing? It comes preinstalled in all versions post 5.1 (though 5.1 itself is limited). [1]: https://learn.microsoft.com/en-us/powershell/module/powershellget https://learn.microsoft.com/en-us/powershell/module/powershe...
- moomin 1y agoTFW where you're dead wrong and have to upvote everyone who told you so...
- pjmlp 1y agoNot only it has modules, there are several NuGet like repos for Powershell.
- Natfan 1y agoFalse: https://www.powershellgallery.com/ https://www.powershellgallery.com/
- shagmin 1y agoEspecially for C# developers. You can use any CLR (e.g. C#) objects in powershell, for prototyping, automation, proof of concept, etc.,.
- noodletheworld 1y agoIt is reasonably unlikely that bash scripts are easily replaceable by powershell scripts. Theres a fair argument that complex scripts require a complex scripting language, but you have to have a good reason to pick powershell. Typically, on non-windows, there is not one. Its the same “tier” as bash; the thing you use because its there and then reach past for hard things. The same reason as bash. Theres no realistic situation I would (and Ive written a lot of powershell) go, “gee, this bash script/makefile is too big and complex, lets rewrite it in powershell!”
- kardianos 1y agoThe author's didn't come out against it; they came out in favor of using it as a programming language first and foremost. Tools like gorun https://github.com/erning/gorun https://github.com/erning/gorun have existing for almost as long as Go has, so if you want to use Go that way, it is easy to do. They recently added in support to do this: go run github.com/kardianos/json/cmd/jsondiff@v1.0.1 Which pulls a tag and runs it directly, which is also kinda cool.
- sureglymop 1y agoThis can also be done with Rusts cargo. Though it's not yet stabilized: https://rust-lang.github.io/rfcs/3424-cargo-script.html https://rust-lang.github.io/rfcs/3424-cargo-script.html
- Arnavion 1y agoThe builtin subcommand is unstable, but a long time ago a dev I knew at the time maintained an external subcommand for it. https://crates.io/crates/cargo-script https://crates.io/crates/cargo-script Although it's old and its dependencies are old, it doesn't have a dependency on cargo (it spawns cargo as a subprocess instead of via cargo API directly), so it might still work fine with latest toolchain. I haven't tried myself.
- Meph504 1y agoI wonder where the divide of "shebang" vs "hashbang" lands geographically and chronologically, During college and for many years in the early 90s and 2000s in the south it commonly called hashbang, didn't hear shebang until C# became a thing, I know it predates that, just never heard it before then.
- cheschire 1y agoI was a Unix sysadmin back in the late 90’s in east coast US and we called it a shebang when writing shell or perl scripts
- Meph504 1y agoI always found it interesting as the sharp term including C# was odd because it isn't the sharp symbol, which is ♯. All of them use the # hash character, so calling it sharp always seemed odd to me, though C-Hash also doesn't roll of the tongue admittedly. It is also interesting how hash is correctly used in some places "Hash Tag" but not others.
- cheschire 1y agoIndeed. I joked on slashdot that C# was pronounced “cash” back when it was first announced, which seemed appropriate given the company. The joke didn’t land, sadly.
- jahsome 1y agoIt lands for me, today :)
- Arnavion 1y agoIn 2010 I met a person from India who pronounced it "C pound", and they were as confused by my reaction as I was by their pronunciation. I guess somehow that pronunciation became popular enough that it acquired momentum and everyone in their circle (or maybe all of India?) assumed it was correct. The # key on the phone is called the "pound key" in India, which is where it would've started from, and I guess they never heard any foreigner Youtube video etc pronouncing it. I don't know if they still pronounce it that way or not.