From 366f46cdd608577d91ed94a13241e72e4494346f Mon Sep 17 00:00:00 2001 From: Sangelo Date: Mon, 6 Mar 2023 22:36:12 +0100 Subject: [PATCH] Try out error catching in script --- install.sh | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/install.sh b/install.sh index bac8803..799affd 100755 --- a/install.sh +++ b/install.sh @@ -18,18 +18,19 @@ if [[ $OSTYPE == 'darwin'* ]]; then esac fi -# Compile program -nim c -o:bin/niminit niminit - -# Create local bin folder if it doesn't exist -mkdir -p $HOME/.local/bin - -# Copy binary to local bin folder -cp bin/niminit $HOME/.local/bin/niminit - -# Create config directory & copy files -mkdir -p $HOME/.config/niminit -cp config/* $HOME/.config/niminit +{ + # Compile program + nim c -o:bin/niminit niminit && + # Create local bin folder if it doesn't exist + mkdir -p $HOME/.local/bin && + # Copy binary to local bin folder + cp bin/niminit $HOME/.local/bin/niminit && + # Create config directory & copy files + mkdir -p $HOME/.config/niminit && + cp config/* $HOME/.config/niminit && +} || { + echo "ERROR: The script errored. There might be some clues above this line." +} # Print info message to export local bin if not already printf "\n"