Sign up ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

I have a script which I need to execute. The script file is Below are the commands that I am using:

dragan@dragan-Lenovo-G570:~/liquibase/liquibase$ chmod +x
dragan@dragan-Lenovo-G570:~/liquibase/liquibase$ ./
invalid file (bad magic number): Exec format error

What error is this and how can I fix it? Thanks in advance!

share|improve this question
What does file say? If it says something with text or shell script, what does head -n 1 say? (In other words, is this really a shell script?) – Ulrich Schwarz Jul 25 '12 at 8:08
I suspect the very first character of the script is something wierd (eg. not #) that should just be deleted. I've seen it before and while rarer, it's a bit similar to the EOL format issue. – lynxlynxlynx Jul 25 '12 at 10:04
@lynxlynxlynx: we're entering very wild guesses now, but files with UTF encoding can start with a byte order marker (BOM, IIRC 0xffef or 0xefff) to indicate endianness. While not useful, apparently sometimes there are files that are UTF-8 encoded and still have a BOM. – Ulrich Schwarz Jul 25 '12 at 11:04
The content of script will also be pretty usefull for helpers. May be it tries to run some strange binary or smth like that and it returens the error. – rush Jul 25 '12 at 12:08
The output of xxd | head -n 1 would be helpful. – Mikel Jul 25 '12 at 14:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.