News for hackers. Stuff that matters.
Re:Bash functions are better than I thought by majormajor on Sunday October 31, 2021 @08:53PM (#29061996)
But once you shell out and require another language, why not just use that other one from the start?
Re:Bash functions are better than I thought by coliveira on Sunday October 31, 2021 @09:24PM (#29062157)
Because the shell is used to do things that are easy in the shell. Examples: file manipulation, sorting, field based processing, pipes. Doing these things in a traditional language is more complex and not necessarily better.
Re:Bash functions are better than I thought by brokenmachine on Monday November 01, 2021 @11:20PM (#29076565)
Except the shell is bad for those things, except pipes I guess.

I just hate doing things with files in the shell, all those stupid escaping rules, and god forbid you have files with spaces or quotes in the names, or leading or trailing spaces.

It's just spending time learning hacks to get around shell limitations instead of actually getting things done, and at the end it's an ugly mess.

Or maybe I'm just bad at it, but I don't think it's only that.

Re:Bash functions are better than I thought by vlovich123 on Sunday October 31, 2021 @10:48PM (#29062583)
It’s not more complex in Python if you use the sh package. All the power of everything you need with a real language when you need to do more.

Packaging in Python is a bit more of a pain.

Re:Bash functions are better than I thought by coliveira on Sunday October 31, 2021 @10:52PM (#29062602)
That's the other part of the problem. The shell is available everywhere. Python needs to be installed. So, if you need shell-related functionality, it is the easiest route to use.
Re:Bash functions are better than I thought by vlovich123 on Monday November 01, 2021 @12:05AM (#29062898)
I have not encountered a system yet where Python isn’t installed out of the box.
Re:Bash functions are better than I thought by dotancohen on Monday November 01, 2021 @03:12AM (#29063825)
Windows, possibly. And as for the *nixes, including Macs, what version is installed? The way Python 2 eol was extended and extended and extended just hurt the whole ecosystem.
Re:Bash functions are better than I thought by vlovich123 on Monday November 01, 2021 @02:39PM (#29070984)
Windows doesn't have bash preinstalled so I'm not sure why you're bringing that up. On all OSes I've used in the past 3-4 years all of them have been Python3 by default. The specific version is largely irrelevant as I could ask you the same question about which version of bash is running on a given OS (e.g. it's not available on Mac out of the box as the default shell is zsh due to GPLv3).
Re:Bash functions are better than I thought by dotancohen on Thursday November 04, 2021 @10:44AM (#29107820)

  > Windows doesn't have bash preinstalled
I meant Python preinstalled.

  > On all OSes I've used in the past 3-4 years all of them have been Python3 by default.
Windows comes with Python preinstalled now?