diff options
author | HimbeerserverDE <himbeerserverde@gmail.com> | 2022-09-02 12:45:56 +0200 |
---|---|---|
committer | HimbeerserverDE <himbeerserverde@gmail.com> | 2022-09-02 12:45:56 +0200 |
commit | fe764ce99208c3ef0b9f3d88178c486524eed209 (patch) | |
tree | 3f0ebc58b5ed681580dc18b80a28c029c1560370 | |
parent | 9ad3f318b1eb574004f7db2306f9c84b5e8c949d (diff) |
shell only: prompt if dir is correct if called directly
-rwxr-xr-x | shell_only.sh | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/shell_only.sh b/shell_only.sh index d915b56..b5924f9 100755 --- a/shell_only.sh +++ b/shell_only.sh @@ -15,6 +15,17 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see <https://www.gnu.org/licenses/>. +function called_directly { + [[ ${SHLVL} -eq 2 ]] +} + +if called_directly; then + echo -e "\e[1m\e[1;31mMAKE SURE YOU ARE IN THE DIRECTORY THIS SCRIPT IS LOCATED IN!" + echo -e "\e[0m\e[1;31mIf you're sure you are in the correct dir, press Enter." + read + echo -e "\e[0m" +fi + function command_exists { command -v $1 &> /dev/null } |