Cool idea and implementation… that said, like the Google contribution guide suggests, I’d rather write less serious programs in Bash than more: But who knows, perhaps Bash++ counts as more...
It's meant to be a simple way to add object-orientation to Bash scripts.
Cool idea and implementation… that said, like the Google contribution guide suggests, I’d rather write less serious programs in Bash than more:
If you are writing a script that is more than 100 lines long, or that uses non-straightforward control flow logic, you should rewrite it in a more structured language now.
But who knows, perhaps Bash++ counts as more structured enough? :P
If you are writing a script that is more than 100 lines long, or that uses non-straightforward control flow logic, you should rewrite it in a more structured language now.
One of the great regrets in my “career” was being given a many-hundred line bash utility to run and “only pay attention to this part. Ignore all the rest.”It was a mess and ran like 6 different...
One of the great regrets in my “career” was being given a many-hundred line bash utility to run and “only pay attention to this part. Ignore all the rest.”It was a mess and ran like 6 different tests.
I did. But long after the project wrapped I realized it was likely a test. I always wished I’d dug into it and broken it up into parts and wrapped it in a starting options dialog.
We have bash with classes, it is called perl/raku. It died long ago because mostly because it is very hard to read. I think the biggest plus of scripting++ languages like perl, python or...
We have bash with classes, it is called perl/raku. It died long ago because mostly because it is very hard to read.
I think the biggest plus of scripting++ languages like perl, python or powershell is that they provide access to libraries / system capabilities directly. Bash and scripting languages in general are more meant to be the glue that connects tools written in more capable languages, like sed, find or grep. It is very hard to provide meaningful enhancements to bash without changing the way all these tools produce / ingest data, or how terminal emulators work. Powershell got there by being built by the owner of operative system, perl and python have big library ecosystems built over time. Bash does not have that much room to expand.
I agree, what makes bash so nice for scripting small programs, is also what makes it so bad for scripting large ones. All the magic one, two or three character sequences are great for small...
I agree, what makes bash so nice for scripting small programs, is also what makes it so bad for scripting large ones. All the magic one, two or three character sequences are great for small compact things, but is really confusing in larger programs. There is benefit to having your whole program fit in one line in bash vw 5 lines in python that's great for when you're writing crontab, but as soon as that grows beyond "I can keep this whole thing in my mind at once" I want to move to something else where return codes are explicit and all the essential builtin functions have names that makes sense.
Cool idea and implementation… that said, like the Google contribution guide suggests, I’d rather write less serious programs in Bash than more:
But who knows, perhaps Bash++ counts as more structured enough? :P
Me, looking at my 6,033 line bash script
One of the great regrets in my “career” was being given a many-hundred line bash utility to run and “only pay attention to this part. Ignore all the rest.”It was a mess and ran like 6 different tests.
I did. But long after the project wrapped I realized it was likely a test. I always wished I’d dug into it and broken it up into parts and wrapped it in a starting options dialog.
Ahh well. Live and learn.
I mean, with enough semicolons, any multi-hundred line bash script can become a one liner! Or two, if you need a shebang, I guess.
We have bash with classes, it is called perl/raku. It died long ago because mostly because it is very hard to read.
I think the biggest plus of scripting++ languages like perl, python or powershell is that they provide access to libraries / system capabilities directly. Bash and scripting languages in general are more meant to be the glue that connects tools written in more capable languages, like sed, find or grep. It is very hard to provide meaningful enhancements to bash without changing the way all these tools produce / ingest data, or how terminal emulators work. Powershell got there by being built by the owner of operative system, perl and python have big library ecosystems built over time. Bash does not have that much room to expand.
EDIT: It is still fun idea to explore, though
I agree, what makes bash so nice for scripting small programs, is also what makes it so bad for scripting large ones. All the magic one, two or three character sequences are great for small compact things, but is really confusing in larger programs. There is benefit to having your whole program fit in one line in bash vw 5 lines in python that's great for when you're writing crontab, but as soon as that grows beyond "I can keep this whole thing in my mind at once" I want to move to something else where return codes are explicit and all the essential builtin functions have names that makes sense.