On 08/28/2018 12:05 PM, Richard W.M. Jones wrote:
On Sat, Aug 25, 2018 at 12:36:54PM +0300, Anatoly Pugachev wrote:
Hello!
virt-what$ git desc
v1.18-6-gd7fd8a7
Latest commit in git "Allow using sysctl, for example when /proc isn't
available"
doesn't look good for me. Can someone please review/revert this commit
or explain me what does this code do (git show -1):
+use_sysctl() {
+ # Lacking /proc, on some systems sysctl can be used instead.
+ OS=$(uname) || fail "failed to get operating system name"
+
+ [ "$OS" == "OpenBSD" ]
That's a bash-ism. POSIX says you have to spell it [ "$OS" = "OpenBSD" ]
+}
Running on a linux:
virt-what# PATH=$PATH:. ./virt-what
./virt-what: 45: [: Linux: unexpected operator
I cannot reproduce this warning. What does uname print on your machine?
The problem is that this is being run on dash (probably a Debian-based
system), and dash does not support bash's extension of ==.
$ uname
Linux
Does '[' (ie. test) exist on your path?
Yes. But dash's builtin [ behaves only according to POSIX.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
_______________________________________________
virt-tools-list mailing list
virt-tools-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/virt-tools-list