Shell Script – Fixing execve: No Such File or Directory Error

bashopensusepython

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.

Best Answer

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