エラー:ディレクトリでバイナリを実行できません。

エラー:ディレクトリでバイナリを実行できません。

特定のディレクトリでいくつかのbashスクリプトを実行する必要があるコミュニティソフトウェアをインストールしました。ただし、これを行うと、次のエラー メッセージが表示されます。

"ERROR: Command: 'source /usr/bin/bash && module list' failed with error '/bin/sh: line 0: source: /usr/bin/bash: cannot execute binary file' from dir '/home/xxx/example1'.

ディレクトリをに変更すると/usr/bin機能します。問題は、ディレクトリからスクリプトを実行する必要があることですexample1。私は成功せずにPATHに/ usr / binを追加しようとしました。どんな意見でも大変感謝いたします。ありがとうございます。

アップデート1:ソフトウェアがシェルスクリプトを生成するために使用するPythonスクリプトは次のとおりです。

def make_env_mach_specific_file(self, shell, case, output_dir=''):
        """Writes .env_mach_specific.sh or .env_mach_specific.csh

        Args:
        shell: string - 'sh' or 'csh'
        case: case object
        output_dir: string - path to output directory (if empty string, uses current directory)
        """
        module_system = self.get_module_system_type()
        sh_init_cmd = self.get_module_system_init_path(shell)
        sh_mod_cmd = self.get_module_system_cmd_path(shell)
        lines = ["# This file is for user convenience only and is not used by the model"]

        lines.append("# Changes to this file will be ignored and overwritten")
        lines.append("# Changes to the environment should be made in env_mach_specific.xml")
        lines.append("# Run ./case.setup --reset to regenerate this file")
        if sh_init_cmd:
            lines.append("source {}".format(sh_init_cmd))

        if "SOFTENV_ALIASES" in os.environ:
            lines.append("source $SOFTENV_ALIASES")
        if "SOFTENV_LOAD" in os.environ:
            lines.append("source $SOFTENV_LOAD")

        if self._unit_testing or self._standalone_configure:
            job = None
        else:
            job = case.get_primary_job()
        modules_to_load = self._get_modules_for_case(case, job=job)
        envs_to_set = self._get_envs_for_case(case, job=job)
        filename = ".env_mach_specific.{}".format(shell)
        if modules_to_load is not None:
            if module_system == "module":
                lines.extend(self._get_module_commands(modules_to_load, shell))
            else:
                for action, argument in modules_to_load:
                    lines.append("{} {} {}".format(sh_mod_cmd, action, "" if argument is None else argument))

        if envs_to_set is not None:
            for env_name, env_value in envs_to_set:
                if shell == "sh":
                    if env_name:
                        lines.append("export {}={}".format(env_name, env_value))
                    else:
                        lines.append("source {}".format(env_value))

                elif shell == "csh":
                    if env_name:
                        lines.append("setenv {} {}".format(env_name, env_value))
                    else:
                        lines.append("echo \"This case includes a shell source file {} which cannot be used from csh type shells\"".format(env_value))
                else:
                    expect(False, "Unknown shell type: '{}'".format(shell))

        with open(os.path.join(output_dir, filename), "w") as fd:
            fd.write("\n".join(lines))

ベストアンサー1

おすすめ記事