Re: shell expansion (globbing) from inside php cli script
| From: | Bob Winter | Date: | Wed, 29 Jun 2005 03:34:05 +0000 |
| Subject: | Re: shell expansion (globbing) from inside php cli script | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-217795@lists.php.net to get a copy of this message | ||
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);
}