system mkdir

noboy nobody at nowhere.com
Thu Mar 18 06:28:06 PDT 2010


I was little bit surprise because 
mkdir -p dmd-2/usr/{bin,lib,src/phobos2,share/man
do the right thing.

But if i make
mkdir -p "dmd-2/usr/{bin,lib,src/phobos2,share/man"
it's wrong.

So i have think the system command wrap quotes about the command.

Perl have the same behaviour.
Thank you for your answer.

Steven Schveighoffer Wrote:

> On Thu, 18 Mar 2010 06:25:20 -0400, noboy <nobody at nowhere.com> wrote:
> 
> > Hello,
> >
> > import std.stdio;
> > import std.process;
> > import std.string;
> >
> >
> > void main() {
> >     string debPackage="dmd-2";
> >     int dmdVersion=2;
> >     auto path =  
> > format("%s/usr/{bin,lib,src/phobos%d,share/man}",debPackage,dmdVersion);
> >     system("mkdir -p " ~ path);
> > }
> >
> >
> > The result:
> > dmd-2/usr/{bin,lib,src
> >
> > it should be
> > dmd-2/usr/bin
> > dmd-2/usr/lib
> > dmd-2/usr/src
> >
> > Kubuntu 8.0.4
> 
> The system function calls the libc system function.  If you don't like the  
> behavior, complain to the developers of libc for Kubuntu.
> 
> If system is behaving differently under C, then that might be D's problem,  
> but I can't tell if that's the case from your example.
> 
> -Steve



More information about the Digitalmars-d-learn mailing list