Reputation: 173
I'm under
Linux version 3.3.4-5.fc17.x86_64 ([email protected]) (gcc version 4.7.0 20120504 (Red Hat 4.7.0-4) (GCC) ) #1 SMP Mon May 7 17:29:34 UTC 2012
trying to run a basic executable script.ksh file with permission 775 and containing:
#!/bin/ksh
echo "hello ya"
but I have:
$./script.ksh
./script.ksh: Exec format error. Binary file not executable.
the problem looks like to come from the shebang but I can't figure out why and how. I can run the script by doing this (note the weird output for the first line):
$ ksh script.ksh
script.ksh[1]: ?o?;??#!/bin/ksh: not found [No such file or directory]
hello ya
some (maybe) useful output:
$ file script.ksh
script.ksh: Korn shell script, UTF-8 Unicode (with BOM) text executable
$ which ksh
/bin/ksh
do you have an idea?
Upvotes: 0
Views: 3761
Reputation: 30709
The first line begins with some invisible characters, as shown in your error message:
?o?;??#!/bin/ksh
: not found
You can confirm this with
od -t x1c -N 10 script.ksh
Remove those characters, and it will now begin with the magic #!
. One way you might be able to do that is
sed -i -e '1s/^[^#]*//' script.ksh
Test it first without the -i
option (you can pipe it into od
to check the result).
Upvotes: 1
Reputation: 173
ok the problem come from the option
set bomb
in the .vimrc config file of vim. Comment this line solve the problem.
Upvotes: 1