Re: Help in checking the OS type...



On 4/25/06, Jay Savage <daggerquill@xxxxxxxxx> wrote:

*Don't top post.*

On 4/25/06, Mazhar <syedmazhar.hasan@xxxxxxxxx> 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 <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
of OS
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
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!




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


Relevant Pages

  • Re: Help in checking the OS type...
    ... It lists me out the operating system name thanks for the same. ... I need to develop a script where in i need to first check the type of OS ... commands and/or system calls for the differnt systems you intend to ...
    (perl.beginners)
  • Re: Background Intelligence Transfer Service
    ... Could not start the Background Intelligence Transfer Service service ... This service is running and lists BITS as a dependent service. ... operating system is Windows XP Home Edition SP2, ...
    (microsoft.public.windowsxp.general)
  • Re: problem with logoff script
    ... the script engine as a process on the workstation and should execute cleanly ... var fso = new ActiveXObject; ... sho.popup('An error occured attempting to get the Operating System Type. ... // Retrieve the script application ...
    (microsoft.public.win2000.group_policy)
  • Re: Talking to *n*x
    ... > more directly with the operating system and I was ... If you're adept at writing shell ... > well write a shell script. ... output from or feed input to a sub-process, ...
    (comp.unix.programmer)
  • Re: How to pass variable to operating system.
    ... Tnx Aho for answering. ... Why must the script take arguments? ... I only need to pass them to the operating system. ... (even if it is the shell) ...
    (alt.php)