|
From: Petar J. <mip...@gm...> - 2016-02-03 22:32:15
|
On Wed, Feb 3, 2016 at 9:49 PM, Mark Wielaard <mj...@re...> wrote: > On Wed, 2016-02-03 at 20:52 +0100, Petar Jovanovic wrote: > > On Thu, Jan 21, 2016 at 12:15 AM, <sv...@va...> wrote: > > > "command -v" is a (POSIX) shell builtin that should work everywhere. > > > "which" might be an external command that might not be installed in > > > which case the shell might just error out. > > > > > This will not work on systems that do not have 'host' installed, as > > vg_regtest script uses '/bin/sh -c' to execute the command, so it will > > return error code 127 and stop the testing. E.g. if I rename "host" to > > "host123" and try it out: > > > > $ /bin/sh -c which host123 && host123 > > $ echo $? > > 1 > > $ /bin/sh -c command -v host123 && host123 > > host123: command not found > > $ echo $? > > 127 > > O, that is annoying. Sorry about that. > So we don't want to use which because that is an external command that > might not be installed (which is how I found out) and we also want to > explicitly test that the host command actually is installed and that it > can resolve the given hostname (in case the build is running on a > networkless host). > > Would the following work? > > prereq: test $(command -v host) && host www.yahoo.com > /dev/null > > It assumes test is always available, but I hope it is. > Yes, I believe that will work. Regards, Petar |