From 6d2b2b772caa6d0f05bcdbe28dcfd80684ba0d21 Mon Sep 17 00:00:00 2001 From: meera malhotra Date: Wed, 26 Jun 2024 09:25:18 -0400 Subject: [PATCH] do not reinstall if already added to path --- install.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/install.sh b/install.sh index ef64cad..5acb9ac 100755 --- a/install.sh +++ b/install.sh @@ -1,11 +1,11 @@ #!/bin/bash current_dr=$(pwd)/bin -#add ope tool to path so user can use in any directory -echo " " >> ${HOME}/.bashrc -echo "export PATH=$current_dr:\$PATH" >> ${HOME}/.bashrc -#rerun bashrc so it's updated to have ope -source ${HOME}/.bashrc +#if path was not already added, add path +if ! grep -q -s "export PATH=$current_dr:\$PATH" ~/.bashrc; then + echo "export PATH=$current_dr:\$PATH" >> ~/.bashrc #add it to path + source ~/.bashrc #rerun bashrc to reset shell +fi #tell user ope tool has been installed -echo "ope has been added to the path successfully" +echo "ope has been added to the path successfully" \ No newline at end of file