dotfiles/fake_home/.vim/templates/skeleton.sh

47 lines
613 B
Bash
Executable File

#!/bin/bash
FRIEND="world"
usage() {
cat <<- EOF
Usage: $0 [OPTION]...
Greets the given friend.
With no friend provided, prints "Hello, world!"
-f, --friend set the name of the friend to greet
-h, --help print this help text
EOF
}
# parse argv variables
while [ "$#" -gt 0 ]; do
case "$1" in
-f | --friend)
FRIEND="$2"
shift 2
;;
-f=* | --friend=*)
FRIEND="${1#*=}"
shift 1
;;
-h | --help)
usage
exit 0
;;
*)
echo "Unrecognized argument ${1#*=}"
echo
usage
exit 1
;;
esac
done
echo "Hello, $FRIEND!"