On Wed, 27 Mar 2002, Dalton Hunter wrote:
> "Miguel Cruz" <[EMAIL PROTECTED]> wrote:
>> Make sure you use unix-style line endings (just \n and no \r).
> Hi, thanks for your reply. I should have been a little clearer. The file is
> created as a result of a PHP script not in TextPad. I am only comparing them
> in Textpad afterward. For example the script contains ...
> <?php
> $sbackup = "#!/bin/sh
> ... multiple line shell script in here ...
> ";
> ... and it creates the file fine but when I go to execute the shell script
> it returns ...
> sh: ./shell_script: No such file or directory

Right. I think the "No such file or directory" message is because it's 
failing to find an interpreter called "/bin/bash\r".

Assuming you're creating the PHP file in Textpad, save it with Unix line
endings rather than Windows line endings. This is a Textpad option (I'm
sitting at the OSX machine so I can't check exactly where it is at the
moment, but trust me, I've used it earlier today).

I think that when your string literal breaks onto the next line, PHP is 
obediently including your Windows-style line endings in $sbackup and thus 
the shell_script file.

> I tried to add a \n at the end of each line in the PHP script but no
> luck.

Windows line ending = \r\n
Unix line ending = \n

So adding a \n won't help. You need to get rid of the invisible \r, using 
the method described above.


PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to