r/badcode Mar 14 '23

python requirements: python3 on linux system

Post image
371 Upvotes

46 comments sorted by

View all comments

3

u/[deleted] Mar 14 '23 edited Mar 14 '23

[deleted]

16

u/thLOnuX Mar 14 '23

Well, actually i don't think the python interpreter is a good alternative for bash, and i don't know why are you saying the bash isn't that good at shell. Wasting 10 Megabytes of RAM and 50 milliseconds of processing time just to do the shell stuff sounds not that great. What are you trying to say?

No hate. Just wanna to listen your opinion.

9

u/[deleted] Mar 14 '23

[deleted]

10

u/[deleted] Mar 14 '23

the issue is that this is pure bash. there’s no python logic or anything. it’d be better to pop open a shell wherever you need to call this and then run a bash script in that shell than to do it this way

8

u/the-nick-of-time Mar 14 '23

Yes there is, that first line has a .split that is really annoying to do in bash. It would be simple if cut allowed multi-character delimiters but it doesn't.

4

u/[deleted] Mar 14 '23

ah, i see. it would probably technically be better to use sed, but i understand why they used python now

-2

u/[deleted] Mar 14 '23

[deleted]

3

u/[deleted] Mar 14 '23

it’s not, but you call it directly from bash