Skip to content

Instantly share code, notes, and snippets.

@YourFriendCaspian
Last active May 1, 2023 10:58
Show Gist options
  • Save YourFriendCaspian/1288f1d64c66f74aabf6f8f60196c6ca to your computer and use it in GitHub Desktop.
Save YourFriendCaspian/1288f1d64c66f74aabf6f8f60196c6ca to your computer and use it in GitHub Desktop.

Revisions

  1. YourFriendCaspian revised this gist May 1, 2023. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion .init.sh
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,4 @@
    #!/bin/bash
    #!/usr/bin/env bash
    # Originally from detro (Ivan De Marino)
    # https://github.com/detro/.bashrc.d/blob/master/.init.sh

  2. YourFriendCaspian created this gist May 1, 2023.
    40 changes: 40 additions & 0 deletions .init.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,40 @@
    #!/bin/bash
    # Originally from detro (Ivan De Marino)
    # https://github.com/detro/.bashrc.d/blob/master/.init.sh

    THIS_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &>/dev/null && pwd )"

    # Common utilities
    case "${OSTYPE}" in
    solaris*) OSNAME="SOLARIS" ;;
    darwin*) OSNAME="MACOSX" ;;
    linux*) OSNAME="LINUX" ;;
    bsd*) OSNAME="BSD" ;;
    msys*) OSNAME="WINDOWS" ;;
    *) OSNAME="${OSTYPE}" ;;
    esac

    # Source all the 'bashrc.d' files
    for BASHRC_D_FILE in `ls ${THIS_DIR}/*.sh`; do
    source $BASHRC_D_FILE
    done

    # Colorful logging helper: INFO (green) level
    function info() {
    echo -e "\e[32m*\e[39m ${*}"
    }

    # Colorful logging helper: WARN (orange) level
    function warn() {
    echo -e "\e[33m*\e[39m ${*}"
    }

    # Colorful logging helper: ERROR (red) level
    function error() {
    echo -e "\e[31m*\e[39m ${*}"
    }

    # Colorful logging helper: just a new line
    function nln() {
    echo ""
    }