#!/usr/bin/env bash # 20260912 - Hyperling # "Install" script to get this program runnable from anywhere on the system. ## Variables ## DIR="$(cd "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" LOCAL=~/bin GLOBAL=/usr/local/bin name_short="nomad" name_long="nomadic-weather" name_abs="weather-list" ## Functions ## ## Parameters ## while getopts ":gslah" arg; do case $arg in g) global="Y" ;; s) short="Y" ;; l) long="Y" ;; a) abstract="Y" ;; h) usage ;; *) echo "ERROR: Parameter $OPTARG was not recognized." && usage 1 ;; esac done ## Processing ## name="" if [[ "$short" == "Y" ]]; then name="$name $name_short" fi if [[ "$long" == "Y" ]]; then name="$name $name_long" fi if [[ "$abstract" == "Y" || ( -z "$short" && -z "$long" ) ]]; then name="$name $name_abs" fi cmd="" dir="$LOCAL" if [[ "$global" == "Y" ]]; then dir="$GLOBAL" cmd="sudo" echo "Requesting sudo privileges... " sudo echo "Success!" fi ## Main ## for prog in $name; do mkdir -pv $dir $cmd cp -v -svf "$DIR"/prototype.js $dir/$prog done ## Finish ## echo "Done!" exit 0