5 ms·
PowerShell is interesting, and I don't consider it evil. I know some people swear by it, and I am not one of those people - I'll take my AWK with a side of Ruby
by qwertyuiop924 10y ago
PowerShell is interesting, and I don't consider it evil. I know some people swear by it, and I am not one of those people - I'll take my AWK with a side of Ruby/Python, and a helping of SCSH, thank you very much.
It does seem a bit out of place in a UNIX system, though. In Windows, PowerShell ties to a ton of strongly typed databases (SysReg, &c) and windows APIs together into a nice package. But on UNIXes, those APIs are already well exposed elsewhere, and that data doesn't exist. UNIX data is typically stored as text, or can be extracted as such easily. We don't tend to do a lot of binary object munging. I mean, maybe if it integrated with databases, it could at least be handly for dealing with RDBMS scripting, but those bindings are available elsewhere - ruby, perl, python, etc. And MS could build bindings to POSIX, so you'd get a PowerShell version of tools like PS that returned objects, but what are you going to do if you want to munge /etc/fstab, and, say, generate user accounts for all your boot filesystems? I could do that with a line of bash and a few lines of AWK. I don't know why I'd want to, but I could.
So to conclude, PowerShell seems like a neat tool, but it was designed for an ecosystem that doesn't exist on the *nixes.
- allendoerfer 10y ago> In Windows, PowerShell ties to a ton of strongly typed databases (SysReg, &c) and windows APIs together into a nice package. […] > UNIX data is typically stored as text, or can be extracted as such easily. They could ally with the systemd folks in their mission to change that.
- kuschku 10y agoWhich I’d be very happy about – see also the discussion about getting the ip for an interface above.
- qwertyuiop924 10y agoAre you out of your mind? Or do you just not understand what you're saying? Adding an interface to PS to get this info natively is good. But Lennart has a magic ability to get everything wrong, and he's NOT messing with my fstab any more than he already has.
- kuschku 10y agoThen which audio system is simple to set up AND allows per-program volume, effects, etc? Which init system "just works" without requiring me to copy and modify a hacky init script from stackoverflow? Lennarts products are controversial, but they’re the classical "least worst" options.
- qwertyuiop924 10y ago>Then which audio system is simple to set up AND allows per-program volume, effects, etc? JACK >Which init system "just works" without requiring me to copy and modify a hacky init script from stackoverflow? s6, runit, bsdinit (yes, really). >Lennarts products are controversial, but they’re the classical "least worst" options. No, they're ugly, broken messes that look nice. Systemd is a monster. If it was an init system, I wouldn't complain, but it's not. It's an init system that's also a cron replacement, a syslog replacement, an automount replacement, a docker replacement, a consolekit replacement, steadily gaining a tight integration with udev, overcomplicates everything it touches (we need a hostname daemon now?), provides libraries to high-level userland that are DELIBERATELY POSIX incompatible, promotes binary formats for no reason, flies in the face of tradition for no reason and breaking code (screen sessions die now), overcomplicates PID1, increasing the chances of a kernel panic, and that's just the tip of the iceberg. Systemd is a tiny step forward, followed by a massive step back, and of you can't see that, you haven't been paying attention.
- kuschku 10y ago> JACK > simple to set up Try getting it to run with basically anything, seriously. Pulseaudio is plug-and-play. > Which init system "just works" Neither of the ones you mention fit that description > It's an init system that's also a cron replacement Wrong. SystemD is a project with a similar branding issue that KDE has. Systemd is a project. It develops a set of libraries. And, on top of that, an init system. And a cron replacement. And a syslog replacement. You do not need to use them together – just like you can use Gtk apps in a KDE environment – but together everything works best. > for no reason and breaking code (screen sessions die now) For the reason that shutting down my PC means it spends 10 minutes waiting for screen sessions to kill themselves, and I can not stop that without either doing a killall, alt-print-reisub, or just pulling the plug? It also provides a way to keep things running still. > increasing the chances of a kernel panic Never had one, and I’m running bleeding-edge arch > Systemd is a tiny step forward, followed by a massive step back, and of you can't see that, you haven't been paying attention. Systemd is the least worst option. There is not much of an alternative for such a kind of project, that properly handles things in a more modern way. I want a userland that works plug-and-play, I want syslog as a daemon with database, not as a fucking flat file. I want more dbus, and, ideally, I’d have all config files in a database or registry for easier administration and sync. I want proper udev and containerization, I want programs of my user to be killed upon logout unless specified otherwise. Lennarts projects don’t provide what the old crowd of nerds want. But they provide what the average user want, and what’s required to make Linux actually usable for your sister, your grandmother, and your retarded neighbor that can’t even turn on a PC. It also reduces the workload for server admins, like me, again. I can write systemd unit files in a few minutes, can easily stream syslog over the network from multiple servers and aggregate, I can easily handle namespacing of software.
- viraptor 10y ago> But on UNIXes, those APIs are already well exposed elsewhere, and that data doesn't exist. I'd go with exposed, but not necessarily well. Examples I run into all the time: get an IP from an interface, change iptables entries, even change fstab options. Sure, if you write enough regex, it will probably work most of the time. But it's never going to be as reliable as get_ips('eth0'), or get_filesystem('/tmp').options.add('nosuid').
- qwertyuiop924 10y agogetting an IP is still pretty ugly, somehow: ip address show dev eno1|grep 'inet '|cut '-d ' -f6 But I wouldn't call it unreliable. The cut is the only really nasty bit. Changing your fstab is easy with a little awk: $2=="/tmp"{$4=$4 ",nosuid"} {print $0} Given, it won't remove contradicting options...
- jjnoakes 10y agoAnd either the "ip" command can never change how it formats its output, or your script with that command will break some day.
- qwertyuiop924 10y ago...Which is why I said it was ugly. The grep probably won't break, the cut is more likely to. This is in part because the 'ip' command isn't very well designed. A better solution I found is ip addr show wlan0 | grep -Po 'inet \K[\d.]+' Which is less likely to break. If your system supports it, hostname -I Works great. However, this seems to be an ubuntuism, and it doesn't work on my system.
- vasilia 10y agoip addr show eth0 | awk '/inet/ { print $2 }' Will be better ;) 'inet[::space::] ' not working with ipv6 addresses.
- 10y ago