diff --git a/README.md b/README.md index 658a196..020f9cc 100644 --- a/README.md +++ b/README.md @@ -11,4 +11,4 @@ This repository contains some (linux) scripts I am using to simplify my daily wo - [Beautify java source code](/java-beautifier) -If you want to use any of the (bash!) scripts globaly, see [pathify](/pathify) +If you want to use any of the scripts globally, execute [globalize.sh](globalize.sh) diff --git a/globalize.sh b/globalize.sh new file mode 100644 index 0000000..7ed891f --- /dev/null +++ b/globalize.sh @@ -0,0 +1,76 @@ +#!/bin/bash + +check_and_exit() { + if [ $? -eq 0 ]; then + echo $1 + exit 0 + else + echo $2 + exit 1 + fi +} + +validate_script() { + if [ ! -f "$1/$1.sh" ]; then + echo "'$1' cannot be globalized" + exit 1 + fi +} + +main() { + while getopts "?h?l?r?" opt; do + case $opt in + h) + echo "Usage: $0 [-l|-r]