1. 2

    Taking a break. It’s the weekend. Give yourself a moment away from the computer.

    1. 1

      Yup.

      Instead of hacking yesterday, I made lemonade and went swimming in a beautiful, quiet lake just to take nap on the grass afterwards - refreshing af.

    1. 2

      Lots of things can already be done with portable sh code. typeset for example is quite powerful but mentioned nowhere in the repo:

      $ var=VaL; typeset -l lvar=$var; typeset -u uvar=$var
      $ echo $lvar $uvar
      val VAL
      

      In fact, this builtin is often wrapped by the shell itself, at least in OpenBSD’s ksh:

      $ alias | fgrep typeset
      autoload='typeset -fu'
      functions='typeset -f'
      integer='typeset -i'
      local=typeset
      
      1. 2

        typeset is not posix

        • posix sh has no way to do what typeset -f does
        • bash has no way to do what typeset -fu does in your ksh
        • typeset -i doesn’t really have the same effect in bash and ksh
        • the posix way to convert a string to lowercase/uppercase involves tr or awk
        • most popular shells support local, but it’s not posix either

        “portable sh code” != “it works on my openbsd”

        1. 1

          Note how I did not speak of POSIX; you mistake the ksh example as general assumption. My reply to pl’s comment tells you what I meant with “portable” (admittedly, wording was a bit misleading).

          1. 1

            what’s your definition of portable?

        2. 1

          What do you mean with portable sh code? I just tried it with dash and it has no typeset built in.

          1. 2

            At least available in Bourne and Korn shell derivatives; (Debian’s) Almquist Shell does not implement that particular builtin.