hollson / sdk

🐧 Shell Development Kit 🔥🔥🔥
MIT License
3 stars 0 forks source link

Change private internal functions to anonymous functions, such as init #1

Open hollson opened 1 month ago

hollson commented 1 month ago

Unadorned

function init() {
  if [ -n "$SDK_LOG_PATH" ]; then
    LogPath="$SDK_LOG_PATH"
  fi
}
init

Recommended

#!/bin/bash

(function () {
    echo "This is an anonymous function."
})  

# You can also pass parameters
(name="John"; (function () {
    echo "Hello, $name!"
}))