6
Aldar
4y

Sometimes, I feel like tearing my hair out from the way Bash works.

Like... Where other languages have two operators for case-sensitive and insensitive regex matching, bash? It doesn't. It only matches case-sensitively.

And if one wants the insensitive matching? Gotta set a shell option... And if a script wouldn't change it back, who knows what else could break, so of course it has to save its initial state, change it, do its case-insensitive matching, and return it back to its original value.

10/10 experience.

Comments
  • 2
    I can totally understand the frustration.

    Bash is OLD. Like methusalem old.

    And there are many many many many many things in Bash that can drive someone insane....
  • 1
    Do what my insane startup founder does:
    wrap bash scripts in a makefile!

    I will show myself out....
  • 1
    Bash was modern and innovative in the late 90s when I first started using it, but it hasn't changed much since then.
  • 1
    @magicMirror That is.... pretty dumb.

    @bahua Yes... And I don't think it will change much. Since it is essentially the backbone of a lot of stuff ^^

    All in all I only use bash for simple tasks.

    Everything else -> Python / PHP

    As Python 2 is finally dead, it's safe to use Python 3
  • 0
    @IntrusionCM I mean, yes, bash is totally not well suited for complex projects, but I recently found myself writing a, more complex than I would have liked, cli completion script, and...

    The way arrays are handled in bash hurts my brain. Yet I cannot use something like python as the spinup time of the interpreter can be anything, from half a second, to a couple of seconds... And that would make the completion unusable with how often I spam tab.

    Which is why I found myself looking for a way to communicate over XML-RPC in pure bash whilst screaming to all the gods out there to rid me of this curse.
  • 0
    @Aldar what the frigging fuck....?
  • 0
    @Aldar

    This may sound like the advice of a 41 year old career sysadmin(because it is) but perl has no such spin-up. It's perfect for the use case you're suggesting.
  • 0
    @aldar

    ok... might have sounded a bit harsher than I wanted it to be...

    The startup time shouldn't be extreme in python, since it usually compiles the stuff on first generation and generates PYC files.

    And what do you mean by completion? Like in bash completion?

    And why XML-RPC....

    It sounds really terrifying... Oo
  • 0
    @bahua i wish, but ever since I saw some of our internal tools that are written in perl, I got scared for life. Its soooooo weeeeeeird x.x

    @IntrusionCM no worries, its an absolutely ugly thing. On top of xml-rpc, it also has to communicate over a unix socket, adding another layer of complication.

    And, yes, bash completion.

    As to why it takes that long, well... My only guess is... It runs on servers under load, and many different machines that do not have it compiled already.
  • 0
    @Aldar I cannot stop being curious..
    .

    Just what the hell is it what you're building?

    Bash Completion. OK.

    XML RPC / Socket? Does it call an service to get the completion sequence?

    And yes. Perl isn't less terrifying.

    Although... XML parsing in Bash... Sockets maybe, painful. But possible.

    But XML? Ay caramba...
  • 0
    @Aldar Why not build your tool in something that you can compile rather than interpret ?
  • 0
    @IntrusionCM We use this thing called supervisord - a supervisor daemon written in python.

    Across our server base, I can only be sure that it provides a socket to communicate over.

    And the service only communicates over that socket using XML-RPC.

    Yes, I could use REST when there is also HTTP server in use, but that's not everywhere.

    And, although I tried, I failed to parse out and differentiate which supervised services are running and which not. Issue came only when there are multiple instances of one program, leading me into having to communicate with the daemon itself... No other way I could think of solving that.
  • 1
    @CptFox To be honest? I don't use many compiled languages at all... Like... On the top of my head, I could maybe, maaaaybeeeee whip up something in C++... But... Haven't touched that language in ages.

    My daily bread and butter are Python and Bash...
  • 0
    @Aldar this makes a whole lot more of sense now. :)
Add Comment