May 21, 2009, 8:18 AM
Re: [Adskiy] How do I find out which system I'm running under?
If you are running under L/Unix or Windows/cygwin:
Be aware that not all versions of uname report the same strings for the same thing, so this kind of code needs testing on various platforms.
$os = `uname -o`;
$os =~ tr/\r\n//d; # Same as chomp();
$os = lc($os);
$os = 'win32' if $os eq 'cygwin';
my $arch = lc(`uname -m`);
$arch =~ tr/\r\n//d;
$arch = lc($arch);
print "I am an $arch machine running the $os operating system.\n";
If you need precise information on the Windows variant or you don't use cygwin, this won't help.
(This post was edited by 1arryb on May 21, 2009, 8:26 AM)