You are browsing as a guest. Sign up (or log in) to start making projects!

8h 25m 26s logged

Devlog #4

Hello!

I am now working on a big refactor (again).

I am planning to write a .sh script that can be used in either alpine or debian based image.

A rough description of what I am making from my previous Devlog:
I am making an OCI Image, basically a Docker image, that includes Nginx and a bunch of third-party modules and runs out of the box.

Leanred

I was almost new to .sh scripts. I knew it is similar to the command used in Terminal, but I didn’t know there are actually some huge difference.

  • case and if
    • I learned how to use the case command.
    • I learned more about the if command.
    • A quick example:
      # /bin/sh
      
      # Example for Case
      case ${YOUR_ENV} in 
      "Apple")
      echo "The ENV is Apple"
      # Ending symble
      ;;
      "Orange"|"Banana")
      echo "The ENV is either Orange or Banana"
      ;;
      # Ending symble
      esac
      
      # Example for if:
      
      # Conditions can be:
      
      [ -z ${YOUR_ENV} ] # If the ENV is empty
      [ ${YOUR_ENV} == "Hi" ] # If the ENV matches the string Hi
      
      # The space after the "[" and before the "]" is super important. It cannot be forgotten. 
      
      # Read more about the space:
      # https://www.shellcheck.net/wiki/SC1020
      
      if [ condition ]; then
           echo "The condition is True!"
      else
          echo "The condition is not True!"
      
      # Ending symble
      fi
      

More information will be provided in the next Devlog (Devlog #5 ).

So many ARGs in the photo!

0
9

Comments 0

No comments yet. Be the first!