Reply to Re: [PHP] shell expansion (globbing) from inside php cli script

Your name:

Reply:


Posted by Bob Winter on 06/29/05 06:34

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);
> }

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация