exec("ls *.*") gives unexpected output

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • kurt.krueckeberg@gmail.com

    #1

    exec("ls *.*") gives unexpected output

    The second line of this script
    <?php
    // current directory
    echo getcwd() . "<br />";
    print ( exec("ls *.*") );
    ?>
    should display the names of the four files (it does in an ssh session)
    which are located in public_html, but instead it displays just one
    filename, that of this script.

    I don't understand why?

  • Chris Hope

    #2
    Re: exec(&quot;ls *.*&quot;) gives unexpected output

    kurt.krueckeber g@gmail.com wrote:
    [color=blue]
    > The second line of this script
    > <?php
    > // current directory
    > echo getcwd() . "<br />";
    > print ( exec("ls *.*") );
    > ?>
    > should display the names of the four files (it does in an ssh session)
    > which are located in public_html, but instead it displays just one
    > filename, that of this script.
    >
    > I don't understand why?[/color]

    It would be a good idea to refer to the manual:


    Note in particular:
    "Return Values
    The last line from the result of the command. If you need to execute a
    command and have all the data from the command passed directly back
    without any interference, use the passthru() function."

    --
    Chris Hope | www.electrictoolbox.com | www.linuxcdmall.com

    Comment

    Working...