Ask a Question related to PERL Miscellaneous, Design and Development.
-
Tof #1
system und metachar
Hi from a newby,
I wanted to use system like: system("mv","*","targetDir);
But * ist not interpreted at all and the commande failed.
What would be the best way to do that ?
Greetings from Paris,
Christophe
Tof Guest
-
Some 'System Calls' was Capturing system call output value
On Friday, Nov 14, 2003, at 18:39 US/Pacific, Jerry Rocteur wrote: Wiggins is the one who deserves the point, since he was the one with the... -
System.Net.WebException occurred in system.web.services.dll - HTTP status 405: Method not allowed.
Hi, Have anyone ever encountered an exception error: The request failed with HTTP status 405: Method not allowed when trying to remotely invoke a... -
The type System.Web.UI.WebControls.TextBox in Assembly System.Web...error
I've been getting this error every since I installed InstallSqlState to handle my viewState Sessions. it only happens on 1 section of my asp.net... -
Method not found: System.Collections.Specialized.NameValueCollection System.Web.HttpRequest.get_QueryString().
I just recently started getting the above error on a page I am posting MULTIPART/FORM-DATA. We have SoftArtisans FileUp component and Filter... -
How to: Network XP system to system running 2000?
I have a desktop running XP. I have a laptop running 2000. They share an internet connection through a Linksys wireless router. My question... -
Shawn Corey #2
Re: system und metachar
Tof wrote:
Bonjour,> Hi from a newby,
>
> I wanted to use system like: system("mv","*","targetDir);
> But * ist not interpreted at all and the commande failed.
> What would be the best way to do that ?
>
> Greetings from Paris,
>
> Christophe
Try: system( "mv * targetdir" );
Shawn Corey Guest
-
Tad McClellan #3
Re: system und metachar
Tof <adjudant.tassin@laposte.net> wrote:
> I wanted to use system like: system("mv","*","targetDir);
This part of the description of the system() function will
be important here:
Note
that argument processing varies depending on the
number of arguments. If there is more than one
argument in LIST, or if LIST is an array with more
than one value, starts the program given by the
first element of the list with arguments given by
the rest of the list. If there is only one scalar
argument, the argument is checked for shell
metacharacters, and if there are any, the entire
argument is passed to the system's command shell
for parsing
So your call above will not invoke a shell.
> But * ist not interpreted at all
Because it is the shell that interprets it, and there is no shell.
> and the commande failed.
> What would be the best way to do that ?
Either expand it yourself:
!system('mv', glob('*'), 'targetDir') or die "mv failed $!";
#or
!system('mv', <*>, 'targetDir') or die "mv failed $!";
Or call system such that it _will_ invoke a shell (and accept
all of the dangers that go with it):
!system('mv * targetDir') or die "mv failed $!";
--
Tad McClellan SGML consulting
[email]tadmc@augustmail.com[/email] Perl programming
Fort Worth, Texas
Tad McClellan Guest
-
Chris Mattern #4
Re: system und metachar
Tof wrote:
When you hand system multiple strings, it directly invokes> Hi from a newby,
>
> I wanted to use system like: system("mv","*","targetDir);
> But * ist not interpreted at all and the commande failed.
> What would be the best way to do that ?
>
the first string as the program name, passing it the other
strings as parameters. The shell is never invoked, so none
of the shell metacharacters get interpreted. In order to
get system to invoke the shell to parse your command line,
you need to pass it only *one* string, like so:
system("mv * targetDir");
Chris Mattern
Chris Mattern Guest



Reply With Quote

