bin/bash^M: bad interpreter Error with fred's script

A plethora of command-line scripts that perform geometric transforms, blurs, sharpens, edging, noise removal, and color manipulations.
Post Reply
nasir101m
Posts: 6
Joined: 2013-05-26T23:44:22-07:00
Authentication code: 6789

bin/bash^M: bad interpreter Error with fred's script

Post by nasir101m »

I am working with fred's texteffect script, but when i run it on my web server this error.

Array ( [0] => sh: ./texteffect.sh: /bin/bash^M: bad interpreter: No such file or directory [1] => sh: ./texteffect.sh: /bin/bash^M: bad interpreter: No such file or directory )


can anyone help me please?

Here is code

Code: Select all

<?php
// Run the script
exec("./texteffect.sh -t \"SOME GLOW TEXT\" -s glow -e normal -f verdana.ttf -p 48 -c skyblue -b white -o skyblue -l 1 -g blue fred.png 2>&1", $array); 
//Display any errors
echo "<br>".print_r($array)."<br>"; 
echo "</pre>";
?> 

<img src="fred.png">

<?php
// Run the script
exec("./texteffect.sh -t \"SOME ARCTOP TEXT\" -s plain -e arc-top -a 180 -f Arial -p 48 -c skyblue -b white -o black -l 1 -u lightpink fred1.png 2>&1", $array); 
//Display any errors
echo "<br>".print_r($array)."<br>"; 
echo "</pre>";
?> 

<img src="fred1.png">
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: bin/bash^M: bad interpreter Error with fred's script

Post by fmw42 »

try

exec("bash ./texteffect.sh -t \"SOME GLOW TEXT\" -s glow -e normal -f verdana.ttf -p 48 -c skyblue -b white -o skyblue -l 1 -g blue fred.png 2>&1", $array);

Also edit the script to change dir="." to dir="/tmp". Also be sure the script is made executable in its permissions.

follow the instructions for use with PHP at http://www.fmwconcepts.com/imagemagick/index.php
nasir101m
Posts: 6
Joined: 2013-05-26T23:44:22-07:00
Authentication code: 6789

Re: bin/bash^M: bad interpreter Error with fred's script

Post by nasir101m »

After adding "bash" in code line its giving this error.


Array ( [0] => ./texteffect.sh: line 211: : command not found [1] => ./texteffect.sh: line 236: : command not found [2] => ./texteffect.sh: line 239: : command not found [3] => ./texteffect.sh: line 244: syntax error near unexpected token ` ' [4] => ./texteffect.sh: line 244: `usage1() ' )
1
Array ( [0] => ./texteffect.sh: line 211: : command not found [1] => ./texteffect.sh: line 236: : command not found [2] => ./texteffect.sh: line 239: : command not found [3] => ./texteffect.sh: line 244: syntax error near unexpected token ` ' [4] => ./texteffect.sh: line 244: `usage1() ' [5] => ./texteffect.sh: line 211: : command not found [6] => ./texteffect.sh: line 236: : command not found [7] => ./texteffect.sh: line 239: : command not found [8] => ./texteffect.sh: line 244: syntax error near unexpected token ` ' [9] => ./texteffect.sh: line 244: `usage1() ' )
1



I have also change path of script but its not working. script permissions are 0755. And its a linux server.
ImageMagick Version 6.6.3-4

Please help me, it is very important for my project.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: bin/bash^M: bad interpreter Error with fred's script

Post by fmw42 »

I think you might have a corrupted script file with bad line endings. Many of the lines referenced are empty lines. That makes me think that the line endings for those lines or the lines just prior are incorrect.

Open the file in a text editor that allows you to set the line endings to new lines only (nl or \n). See if that helps.

What kind of server are you using and what software is it running? What is the web site?
nasir101m
Posts: 6
Joined: 2013-05-26T23:44:22-07:00
Authentication code: 6789

Re: bin/bash^M: bad interpreter Error with fred's script

Post by nasir101m »

User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: bin/bash^M: bad interpreter Error with fred's script

Post by fmw42 »

Did you edit the file as I suggested to make sure the line endings are correct?

What kind of Linux server is it?

Where is IM located? Have you added the path to IM to your PATH?

Did you read the Pointers for use with PHP from my web site?
Last edited by fmw42 on 2013-05-27T22:01:06-07:00, edited 1 time in total.
nasir101m
Posts: 6
Joined: 2013-05-26T23:44:22-07:00
Authentication code: 6789

Re: bin/bash^M: bad interpreter Error with fred's script

Post by nasir101m »

No, should i edit just endings of error line ?
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: bin/bash^M: bad interpreter Error with fred's script

Post by fmw42 »

nasir101m wrote:No, should i edit just endings of error line ?
No you must make sure all lines of the file have the correct line endings.


What kind of Linux server is it?

Where is IM located? Have you added the path to IM to your PATH?

Did you read the Pointers for use with PHP from my web site?

Any progress in your testing these issues?
Last edited by fmw42 on 2013-05-28T11:07:15-07:00, edited 1 time in total.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: bin/bash^M: bad interpreter Error with fred's script

Post by fmw42 »

You do realize that if we get this working, then you or your client will need to purchase a license to use the script in a commercial environment.
nasir101m
Posts: 6
Joined: 2013-05-26T23:44:22-07:00
Authentication code: 6789

Re: bin/bash^M: bad interpreter Error with fred's script

Post by nasir101m »

yes i will
Post Reply