php exec error

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • IronMonk

    php exec error

    i cannot execute the exec command and pass varaible through it

    exec('/secure/sed_repl.sh "route add -host $obj->host device $device2" "" ');

    I have to execute it this way ...
    exec('/secure/sed_repl.sh "this one" "this one to" ');

    thanks
  • Alvaro G Vicario

    #2
    Re: php exec error

    *** IronMonk wrote/escribió (17 Jun 2004 07:36:19 -0700):[color=blue]
    > i cannot execute the exec command and pass varaible through it
    >
    > exec('/secure/sed_repl.sh "route add -host $obj->host device $device2" "" ');[/color]

    If $obj and $device2 are PHP variables, they won't be parsed since they are
    inside a string delimited by single quotes.

    $foo='John';
    echo '$foo'; // Prints $foo
    echo "$foo"; // Prints John


    --
    --
    -- Álvaro G. Vicario - Burgos, Spain
    --

    Comment

    • Michael Austin

      #3
      Re: php exec error

      IronMonk wrote:[color=blue]
      > i cannot execute the exec command and pass varaible through it
      >
      > exec('/secure/sed_repl.sh "route add -host $obj->host device $device2" "" ');
      >
      > I have to execute it this way ...
      > exec('/secure/sed_repl.sh "this one" "this one to" ');
      >
      > thanks[/color]


      create a sh script that does the route add and takes 3 input parameters,
      $adddelete $obj and $device2

      where $adddelete = "add" or "delete"

      then

      exec('/secure/sed_adddeleteho st.sh $adddelete $obj $device2 "" ');



      Michael Austin

      Comment

      Working...