From b4deae5b575fe107fa9ad98c33d905f543f6ca62 Mon Sep 17 00:00:00 2001 From: Ren Tatsumoto Date: Fri, 31 Dec 2021 16:47:40 +0300 Subject: [PATCH] avoid cd if running from the same directory see #8 --- antp.sh | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/antp.sh b/antp.sh index 0c40749..ebc2ddb 100755 --- a/antp.sh +++ b/antp.sh @@ -1,9 +1,11 @@ #!/bin/sh -e -readonly this=$(readlink -f -- "$0") -readonly dir=$(dirname -- "$this") readonly module=antp -cd -- "$dir" || exit +if ! [ -d "$module" ]; then + readonly this=$(readlink -f -- "$0") + readonly dir=$(dirname -- "$this") + cd -- "$dir" || exit 1 +fi python3 -m "$module" "$@"