install, add a remove option.

This commit is contained in:
me committed 2026-09-12 12:25:28 -07:00
1 parent cde66dcd67
commit d70c5d3069
1 file changed
+10 -3
+10 -3
View File
@@ -16,12 +16,13 @@ name_abs="weather-list"
## Parameters ##
while getopts ":gslah" arg; do
while getopts ":gslarh" arg; do
case $arg in
g) global="Y" ;;
s) short="Y" ;;
l) long="Y" ;;
a) abstract="Y" ;;
r) remove="Y" ;;
h) usage ;;
*) echo "ERROR: Parameter $OPTARG was not recognized." && usage 1 ;;
esac
@@ -41,10 +42,16 @@ if [[ "$abstract" == "Y" || ( -z "$short" && -z "$long" ) ]]; then
fi
cmd=""
if [[ -z "$remove" ]]; then
cmd="cp -v $DIR/prototype.js"
else
cmd="rm -v"
fi
dir="$LOCAL"
if [[ "$global" == "Y" ]]; then
dir="$GLOBAL"
cmd="sudo"
cmd="sudo $cmd"
echo "Requesting sudo privileges... "
sudo echo "Success!"
fi
@@ -53,7 +60,7 @@ fi
for prog in $name; do
mkdir -pv $dir
$cmd cp -v -svf "$DIR"/prototype.js $dir/$prog
$cmd $dir/$prog
done
## Finish ##