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--
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/
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--
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/