Skip to content

Commit

Permalink
try to make script execute without interaction if needed
Browse files Browse the repository at this point in the history
  • Loading branch information
Porco-Rosso committed Jul 26, 2024
1 parent a79990f commit c2373d7
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
#! /bin/bash

# Warn user of destruction
# Check if interactive and warn user of destruction
case $- in
*i*)
printf "\033[1;31mThis script will permanently delete your current MOTD. I am not responsible for any potential harm.\033[0m\n"
printf "\033[1;31mAre you sure you want to proceed?\033[0m\n"
read -p -r "Continue (y/n)?" CONT
;;
*) CONT="y" ;;
esac
printf "\033[1;31mThis script will permanently delete your current MOTD. I am not responsible for any potential harm.\033[0m\n"
printf "\033[1;31mAre you sure you want to proceed?\033[0m\n"
read -p -r "Continue (y/n)?" CONT
Expand Down Expand Up @@ -68,5 +76,4 @@ if [ "$CONT" = "y" ]; then

else
printf "\033[1;31mBetter safe than sorry, maybe try manually installing?\033[0m\n"
return
fi

0 comments on commit c2373d7

Please sign in to comment.