我最近将采用openjdk-13 替换为采用openjdk-16。我有一个按名称使用该工具的脚本文件,因此我将其从 13 更改为 16。它的新内容:
#!/bin/bash
if [ -z ${JAVA_OPTS+x} ]
then
# Set some defaults
JAVA_OPTS=""
fi
/Library/Java/JavaVirtualMachines/adoptopenjdk-16.jdk/Contents/Home/bin/java $JAVA_OPTS -jar $CROMWELL_HOME/womtool.jar "$@"
me $ which bash
/bin/bash
me $ ll /usr/local/cromwell
total 16
drwxr-xr-x 6 root wheel 192B Sep 27 12:43 ./
drwxr-xr-x 23 root wheel 736B Nov 10 2020 ../
-rwxr-xr-x@ 1 root wheel 210B Sep 27 12:42 cromwell*
lrwxr-xr-x 1 root wheel 39B Jul 14 15:14 cromwell.jar
-rwxr-xr-x@ 1 root wheel 208B Sep 27 12:41 womtool*
lrwxr-xr-x 1 root wheel 38B Jul 14 15:14 womtool.jar
m082166@me $ $CROMWELL_HOME/womtool validate MyWDL.wdl
-bash: /usr/local/cromwell/womtool: /bin/bash: bad interpreter: Operation not permitted
me $ /Library/Java/JavaVirtualMachines/adoptopenjdk-16.jdk/Contents/Home/bin/java $JAVA_OPTS -jar $CROMWELL_HOME/womtool.jar validate MyWDL.wdl
Success!
当运行脚本的内容完全没问题时,为什么 bash 拒绝让我运行脚本?在我更新脚本文件以指向正确的工具后,这实际上就坏了
感谢 elfshift 这就是答案。显然 MacOS 决定将这些文件放入“隔离区”,因此不让我运行这些文件
解决了这个问题