大网数据广告活动
服务器运维问答

Running a Shell script, I get the error: Warning: execve: No such file or directory

· 52CE 我爱测

I'm trying to run the following script: #!/bin/bash set -e python process_init.py python process_global_variables.py python process_strings.py python process_skills.py python process_music.py python process_animations.py python p…

问题原文

原帖链接 · Rune Seidleitr · CC BY-SA 4.0

I'm trying to run the following script:

#!/bin/bash
set -e
python process_init.py
python process_global_variables.py
python process_strings.py
python process_skills.py
python process_music.py
python process_animations.py
python process_meshes.py
python process_sounds.py
python process_skins.py
python process_map_icons.py
python process_factions.py
python process_items.py
python process_scenes.py
python process_troops.py
python process_particle_sys.py
python process_scene_props.py
python process_tableau_materials.py
python process_presentations.py
python process_party_tmps.py
python process_parties.py
python process_quests.py
python process_info_pages.py
python process_scripts.py
python process_mission_tmps.py
python process_game_menus.py
python process_simple_triggers.py
python process_dialogs.py
python process_global_variables_unused.py
python process_postfx.py
rm *.pyc
echo
echo ______________________________
echo
echo Script processing has ended.
/bin/bash

I get this error:

Warning: Could not start program '/home/lhossangren/source/build_module.sh' with arguments '/home/lhossangren/source/build_module.sh'.

Warning: execve: No such file or directory

I am running OpenSUSE 15.1, and have both the 64 and 32 bit libraries for Python 2.7.3.

Edit: Also, when I try to execute the file by command line, I get:

invalid option line 2: set: - set: usage: set [-abefhkmnptuvxBCHP] [-o option-name] [--] [arg ...]
': [Errno 2] No such file or directorypy
': [Errno 2] No such file or directoryl_variables.py etc, for each of the .py files listed in the script.

已采纳解答

原帖链接 · Piotr P. Karwasz · CC BY-SA 4.0

You probably used Windows line endings (\r\n) in the file, so the kernel can not find the interpreter /bin/bash^M, bash can not parse set -e^M and so on.

Any decent editor can correct line endings. Otherwise you can also use tr:

tr -d '\r' <build_module.sh >build_module_corrected.sh

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2020-01-06)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。