Printing Bash and Kernel Version numbers using Perl

--20cf3054a289776305049e5299fd
Content-Type: text/plain; charset=UTF-8

Hi,

Wanted to have suggestions to modify below 1 liner so that it can also print
Shell (preferably Bash) version and along with Operating System Kernel
version.

Currently I am just printing the place holders for Shell and Kernel version
numbers.

perl -MConfig -le 'print
"$Config{perlpath}:$^V\n$ENV{SHELL}:<Bash_or_Shell_Version>\n/kernel/$^O:<Kernel_Version>"'

TIA

~Parag

--20cf3054a289776305049e5299fd--
Parag Kalra [ So, 13 März 2011 01:51 ] [ ID #2056497 ]

Re: Printing Bash and Kernel Version numbers using Perl

Hello Parag,

> perl -MConfig -le 'print "$Config{perlpath}:$^V\n$ENV{SHELL}:
> <Bash_or_Shell_Version>\n/kernel/$^O:<Kernel_Version>"'

=pod code

perl -MConfig -e 'print "$Config{perlpath}:$^V\n$ENV{SHELL}:" . qx{ bash
--version | head -1 } . "/kernel/$^O:" . qx{ uname -r }'

=cut

Regards,
Alan Haggai Alavi.
--
The difference makes the difference

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Alan Haggai Alavi [ So, 13 März 2011 04:56 ] [ ID #2056499 ]

Re: Printing Bash and Kernel Version numbers using Perl

--0015174487a2dbefd3049e55a4db
Content-Type: text/plain; charset=UTF-8

perl -MConfig -e 'print "$Config{perlpath}:$^V\n$ENV{SHELL}:" . qx{ bash
> --version | head -1 } . "/kernel/$^O:" . qx{ uname -r }'
>

Vern Nice. Completely impressed. But I thought Perl might have some internal
variable at least for Kernel version. But anyways this work for me too.

~Parag

--0015174487a2dbefd3049e55a4db--
Parag Kalra [ So, 13 März 2011 05:29 ] [ ID #2056500 ]

Re: Printing Bash and Kernel Version numbers using Perl

Hello Parag,

> Vern Nice. Completely impressed. But I thought Perl might have some
> internal variable at least for Kernel version. But anyways this work for
> me too.

`Config` module's `config_re` function can be used:

=pod code

use Config 'config_re';

my ($os_version) = config_re('^osvers');
$os_version =~ s/^ osvers= | '//gx;
print $os_version;

=cut

Regards,
Alan Haggai Alavi.
--
The difference makes the difference

--
To unsubscribe, e-mail: beginners-unsubscribe [at] perl.org
For additional commands, e-mail: beginners-help [at] perl.org
http://learn.perl.org/
Alan Haggai Alavi [ So, 13 März 2011 06:19 ] [ ID #2056501 ]
Perl » gmane.comp.lang.perl.beginners » Printing Bash and Kernel Version numbers using Perl

Vorheriges Thema: How to kill child process running in background
Nächstes Thema: how can I get the file header size of tiff images?