Announcement

Collapse
No announcement yet.

GNU Bash 5.1 Released With New "SRANDOM" Variable As A New Means Of Randomness

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • piotrj3
    replied
    Originally posted by dirlewanger88

    Shell scripts should be written in POSIX sh, unless there's a reason not to. bash and zsh mostly add interactive features. Even arrays seem to be coming to sh in the next POSIX spec.

    Also, there's nothing "modern" about bash (not that "modern" actually means anything these days).
    Incomming "modern" sh with entire chromium behind as engine.

    Leave a comment:


  • andreano
    replied
    Originally posted by dirlewanger88
    arrays seem to be coming to sh in the next POSIX spec.
    OMG, finally! Do you have some news to share?

    As someone who has had to deal with busybox, I agree that most of the bashisms are trivially avoidable, and that arrays, as you mention, is the single exception to that. I call POSIX shell disqualified for purposes of safe shellscripting because of that: Arrays are a necessity for correctness way too often in shellscripting.
    Last edited by andreano; 09 December 2020, 04:37 PM.

    Leave a comment:


  • swagg_boi
    replied
    I still use
    Code:
    #!/usr/bin/env sh
    mostly just because I'm too lazy to learn/use the bashisms but I don't knock anyone for using them anymore given the ubiquity of bash. "Portable shell script" is an oxymoron to me

    Leave a comment:


  • pal666
    replied
    Originally posted by dirlewanger88
    Shell scripts should be written in POSIX sh, unless there's a reason not to.
    why should i write programs in obsolete language when my system shell is bash?

    Leave a comment:


  • skeevy420
    replied
    Originally posted by creoflux View Post

    The more likely scenario is that Corporate firewall / policy will prohibit it. Ultimately, I actually agree with this, it is probably a good thing... I just get to re-implement whatever it is.
    I used example that because a lot of what Pip provides is in distribution repositories because of the corporate firewalls, Python being used in system tools, and whatnot. I just think limiting yourself to the bare minimum of something because someone might have to resolve dependencies becomes a little lame at some point...especially with Pip where you end up doing redundant work just to reimplement the wheel. But if someone is dumb enough to pay for that...cool...sounds like you have a sweet gig.

    Leave a comment:


  • creoflux
    replied
    Originally posted by skeevy420 View Post
    or some Python person saying I'm not gonna use Pip because someone might not have the internet available.
    The more likely scenario is that Corporate firewall / policy will prohibit it. Ultimately, I actually agree with this, it is probably a good thing... I just get to re-implement whatever it is.

    Leave a comment:


  • BingoNightly
    replied
    Originally posted by jabl View Post

    Or then you just put "#!/bin/bash" in your shell script and forget about POSIX sh?
    This can be a bit more compatible with the BSDs if you use '#!/usr/bin/env bash' instead, provided bash is installed.

    Leave a comment:


  • sdack
    replied
    Originally posted by dirlewanger88
    ...
    Take a deep breath, stay calm, then read your own comment again and then try to read and comprehend the comments of others in their entirety.

    Right now are you obsessed, suffer a superiority complex and write comments like a child who is counting with its fingers, and I cannot imagine that you would want to be taken serious.

    Leave a comment:


  • Vistaus
    replied
    Originally posted by microcode View Post

    FWIW fish is incompatible even with most POSIX shell stuff. It's no great big deal that it doesn't yet also include this special symbol.
    I can run a lot of Bash stuff and all Bash scripts from fish, so it's not *that* incompatible.

    Leave a comment:


  • sdack
    replied
    Originally posted by dirlewanger88
    Shell scripts should be written in POSIX sh, unless there's a reason not to...
    ... and there is plenty of reason not to!

    What you want to say is that one should use a better shell than what the basic standard has to offer when possible. One finds bash on almost every and even the most basic Linux installations. There is plenty of goodness in bash worth using. From associative arrays, arithmetic expressions, extended variable substitutions and lots more.

    I would sooner force a user to install bash before I give up on these features, because giving up on these when you need them means you'll have to implement these through other means such as command pipes where you end up wasting lots of CPU cycles, create dependencies on external commands (i.e. expr, sed, basename, etc.), and will have to rely on their standard conformance, too.

    POSIX sh is a standard for creating backwards compatibility. Only use it when you need this compatibility more than anything else. Most distribution, i.e. Debian-based ones, use a mix of bash and sh scripts for the system and you can rely on finding a /bin/bash installed.

    And when bash isn't enough then don't hesitate to use perl or python or something else. Don't go backwards, but use the better tools that are out there.

    Leave a comment:

Working...
X