Page 1 of 1

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

Posted: 2013-05-27T08:20:30-07:00
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">

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

Posted: 2013-05-27T12:25:24-07:00
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

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

Posted: 2013-05-27T19:40:56-07:00
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.

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

Posted: 2013-05-27T21:37:10-07:00
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?

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

Posted: 2013-05-27T21:55:32-07:00
by nasir101m

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

Posted: 2013-05-27T21:57:31-07:00
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?

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

Posted: 2013-05-27T22:00:07-07:00
by nasir101m
No, should i edit just endings of error line ?

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

Posted: 2013-05-27T22:02:07-07:00
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?

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

Posted: 2013-05-27T22:04:33-07:00
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.

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

Posted: 2013-05-27T23:07:39-07:00
by nasir101m
yes i will