project_root_path = subprocess.run(f”echo \”$(dirname \”$(dirname \”$(readlink -f \”{__file__}\”)\”)\”)\””, shell=True, capture_output=True, text=True).stdout.strip()かproject_root_path = subprocess.run(f’echo “$(dirname “$(dirname “$(readlink -f “{__file__}”)”)”)”‘, shell=True, capture_output=True, text=True).stdout.strip()を使用することで、pythonのtranslateフォルダ内でプロジェクトのルートパスを取得できた
ターミナルを移動して実行する方法(./test.sh)と、プロジェクトのルートで実行する方法(find . -type f -maxdepth 1 -name “test.sh”)と、エイリアスコマンドから実行する方法(test)があり、それぞれでpwdや$0、readlink -fを実行してみたい