Re: shell expansion (globbing) from inside php cli script

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Brian,

The format of your string that works for me is :

   $cmd = "scp $user@stagingcws.$tld:$directory/\{$files\}  $tmp_dir";

$files must be a comma separated string with NO SPACES.

Here is my complete test script for your review:
====  START  =====
#!/usr/bin/php
<?php

$file1 = 'file_A';
$file2 = 'file_B';
$file3 = 'file_C';
$files = "$file1,$file2,$file3";
$directory = '/tmp';
$user = 'root';
$tld = 'com';
$tmp_dir = '/tmp/test';
$cmd = "scp $user@bmw.$tld:$directory/\{$files\}  $tmp_dir";

exec($cmd, $output, $err);

echo "string: $cmd \n";
echo "status:$err \n";
print_r($output);
?>
=== END ====

Hope this solves your problem.
--Bob


Brian V Bonini wrote:
     if($confirm == "s") { //if staging suck the files down to temp local dir first
        $cmd = "scp $user@stagingcws.$tld:$directory/{{$files}} $tmp_dir/.";
        echo $cmd . "\n\n";
        exec($cmd, $output, $err);
        //shell_exec($cmd);
       }

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


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux