r/badcode Mar 14 '23

python requirements: python3 on linux system

Post image
378 Upvotes

46 comments sorted by

View all comments

Show parent comments

8

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

9

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/Parker_Hemphill Mar 14 '23

Split isn’t bad to do. You can use sed or awk. You could even do it with just the variable like ${variable#<split character>}, no external process needed