Re: Help in checking the OS type...
- From: syedmazhar.hasan@xxxxxxxxx (Mazhar)
- Date: Wed, 26 Apr 2006 09:48:01 +0530
On 4/25/06, Jay Savage <daggerquill@xxxxxxxxx> wrote:
*Don't top post.*
On 4/25/06, Mazhar <syedmazhar.hasan@xxxxxxxxx> wrote:
Paul,go
It lists me out the operating system name thanks for the same. How can i
about getting the different drives/volumes created on the same...of OS
Regards
Mazhar
On 4/25/06, Paul D. Kraus <paul.kraus@xxxxxxxxx> wrote:
On 4/25/06, Mazhar <syedmazhar.hasan@xxxxxxxxx> wrote:
Hi Folks,
I need to develop a script where in i need to first check the type
built,and
then go about in finding the drives.
pkraus@pkraus-laptop:~$ 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
toas determined during the configuration process. The value is identical
$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!
Thanks for the Response Jay. See currently if i have written ti script that
will check the type of operating system.
$Operate_sys=$^O;
if ($Operate="WIN32")
{
Here i have to write the number of logical drives. Then the Total Space
of each drive and the Free Space..
}
if ($Operate="linux")
{
Here i have to write the number of volumes. Then the Total Space of each
volume and the Free Space..
}
I think the above will give you the details of what i am trying to do so.
Thanks in Advance
regards
Mazhar
- References:
- Help in checking the OS type...
- From: Mazhar
- Re: Help in checking the OS type...
- From: Mazhar
- Re: Help in checking the OS type...
- From: Jay Savage
- Help in checking the OS type...
- Prev by Date: Re: match file name at end of a http url
- Next by Date: Re: perl help
- Previous by thread: Re: How To Post (WAS: Help in checking the OS type...)
- Next by thread: Re: Help in checking the OS type...
- Index(es):
Relevant Pages
|
|