Skip to content

Instantly share code, notes, and snippets.

@lucaswinningham
Created May 19, 2021 18:20
Show Gist options
  • Select an option

  • Save lucaswinningham/79d44e8059fa556c994206939accf7df to your computer and use it in GitHub Desktop.

Select an option

Save lucaswinningham/79d44e8059fa556c994206939accf7df to your computer and use it in GitHub Desktop.

Revisions

  1. lucaswinningham created this gist May 19, 2021.
    12 changes: 12 additions & 0 deletions how_to.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    ```bash
    #!/usr/bin/env bash

    this_dir="${BASH_SOURCE%/*}"

    # Recursively iterates over directories looking for .sh files sourcing them if they exist
    for executable in $(find "$this_dir" -regex ".*\.sh"); do
    [ -f "$executable" ] && source "$executable"
    done

    unset this_dir
    ```