Trying to write a small script to install/update dotfiles, but I can't get this part to function properly: The array to read files to install:
APPARRAY=(curl htop ncdu pydf tree tmux vim)
And this is a function that gets called when needed. I'd like it to check if a app exists, if not install it or if it fails then log that to a logfile.
function app_installer(){
for APP in "${APPARRAY[@]}"
do
# echo $APP
#install $APP
if command -v $APP 2> /dev/null; then
echo "$APP already installed!" #>> $LOG
# if command doesnt exist, install it
elif -x command -v $APP 2>/dev/null ; then
echo installing $APP #install $APP
else
echo "$APP FAILED TO INSTALL!!!" #>> $LOG
fi
done
}