*Don't top post.*

On 4/25/06, Mazhar <[EMAIL PROTECTED]> wrote:
> Paul,
>
> It lists me out the operating system name thanks for the same. How can i go
> about getting the different drives/volumes created on the same...
>
> Regards
> Mazhar
>
> On 4/25/06, Paul D. Kraus <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > On 4/25/06, Mazhar <[EMAIL PROTECTED]> wrote:
> > >
> > > Hi Folks,
> > >
> > > I need to develop a script where in i need to first check the type of OS
> > > and
> > > then go about in finding the drives.
> >
> >
> >
> >
> > [EMAIL PROTECTED]:~$ cat testperl.pl && perl testperl.pl
> > print "OS:$^O\n";
> > OS:linux
> > *$^O*
> >
> >  The name of the operating system under which this copy of Perl was built,
> > as determined during the configuration process. The value is identical to
> > $Config{'osname'}.
> > http://www.perl.com/doc/manual/html/pod/perlvar.html
> >
> > HTH,
> > Paul

File systems are system-specific. How you access them and find out
information about them is an OS issue, not a perl issue. Most
operating systems provide some version of the 'df' or 'du' system
commands. Some don't. Most operating systems provide some version of
and fstab file or /proc system. Some don't. If you don't knoe how to
access filsystem information on your system, you need to find a good
reference for your system. There are mailing lists devoted to most
major OSes; there are also many good books. If you need information on
a particular OS, let us know which one, and someone here can probably
point you in the right direction.

If you script needs to be portable, you'll need to lean about the
commands and/or system calls for the differnt systems you intend to
run the script on. Then insert some simple logic to do the right thing
on a particular system, e.g.:

    if ( $^O =~ /some_os/ ) {
        # do something
    } elsif ( $^O =~ /some_os/ ) {
        # do something different
    } elsif ( $^O =~ /some_other_os/ ) {
        # do something completely different
    }

And so on for each OS. You could also check out Sys::Filesystem. but
then you already knew about that, because you took 30 seconds to do a
simple CPAN seach for 'filesystem' before you came to this list,
right?

HTH,

-- jay
--------------------------------------------------
This email and attachment(s): [  ] blogable; [ x ] ask first; [  ]
private and confidential

daggerquill [at] gmail [dot] com
http://www.tuaw.com  http://www.dpguru.com  http://www.engatiki.org

values of β will give rise to dom!

Reply via email to