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

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

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

    GNU Bash 5.1 was released on Monday as the newest feature release to this popular POSIX shell implementation with many extra features...

    Phoronix, Linux Hardware Reviews, Linux hardware benchmarks, Linux server benchmarks, Linux benchmarking, Desktop Linux, Linux performance, Open Source graphics, Linux How To, Ubuntu benchmarks, Ubuntu hardware, Phoronix Test Suite

  • #2
    what does lcut do?

    Comment


    • #3
      CSV sounds good.

      Comment


      • #4
        So now if you the SRANDOM variable then your shell scripts will only work on Bash and it will not work on other shells such as ash, dash, fish, zsh, etc.

        Comment


        • #5
          Originally posted by uid313 View Post
          So now if you the SRANDOM variable then your shell scripts will only work on Bash and it will not work on other shells such as ash, dash, fish, zsh, etc.
          Yes, if you write a modern shell script, it will only work in modern shells.

          You will have to stick with pure unix shell language if you want it to run on the strange and trendy ones like zsh.

          Comment


          • #6
            Originally posted by uid313 View Post
            So now if you the SRANDOM variable then your shell scripts will only work on Bash and it will not work on other shells such as ash, dash, fish, zsh, etc.
            Is there something that would prevent those shells from also having this variable?

            Does srandom have options for guaranteeing certain confidentiality of the randomness so that it won't fall back to less secure versions?

            Comment


            • #7
              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.
              I used to be of the same advice, but nowadays I spend a lot more time doing shell scripting that in the past, because devops (the future is often surprising!), and I find that: 1. bash docs are ubiquitous. 'Posix sh' docs by comparison are an order of magnitude less (this includes man pages as well as blog posts, tutorials, snippets, etc). 2. usage of containers has changed a lot the way we develop: instead of coding for multi-platform we can now let the app dictate the os and provide a container to anyone running a different env. 3. there are many features besides arrays in bash that are nice enough for scripting and not only interactive usage to make me feel awkward every time I try do some 'posix sh'.

              Comment


              • #8
                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).
                Or then you just put "#!/bin/bash" in your shell script and forget about POSIX sh? Depends on what you do of course, but 99% of the shell scripts I write will never run on anything but Linux. My life is too short to worry about writing POSIXly correct sh.

                Now, what you absolutely shouldn't do, and which has caused a lot of headaches in the Linux ecosystem, is writing bash and executing it as POSIX sh. That tends to break when someone like Debian decides that /bin/sh is no longer a symlink to bash.

                Comment


                • #9
                  Originally posted by S.Pam View Post
                  Is there something that would prevent those shells from also having this variable?
                  No, they can also implement it, but right now it is not a standard, so it is a Bashism.

                  Comment


                  • #10
                    Originally posted by uid313 View Post
                    So now if you the SRANDOM variable then your shell scripts will only work on Bash and it will not work on other shells such as ash, dash, fish, zsh, etc.
                    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.

                    Comment

                    Working...
                    X