[libvirt] [test-API PATCH 1/7] utils: Make ipget.sh more portable

Eric Blake eblake at redhat.com
Wed Mar 21 14:32:00 UTC 2012


On 03/21/2012 08:26 AM, Osier Yang wrote:
> On 2012年03月21日 20:46, Peter Krempa wrote:
>> Change the test for existence of nmap to be a little more cross-distro
>> portable.
>> ---
>>   utils/ipget.sh |    4 ++--
>>   1 files changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/utils/ipget.sh b/utils/ipget.sh
>> index cc1949b..4e6b3dd 100755
>> --- a/utils/ipget.sh
>> +++ b/utils/ipget.sh
>> @@ -6,8 +6,8 @@ if [[ -z $mac ]]; then
>>      exit 1
>>   fi
>>
>> -if ! rpm -qa |grep -q nmap ;then
>> -   echo "need nmap rpmball installed."
>> +if ! which nmap>  /dev/null; then

'which' is not as portable as 'type'; POSIX recommends:

type nmap >/dev/null 2>&1

for checking whether nmap is an installed command.

-- 
Eric Blake   eblake at redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 620 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20120321/b840de35/attachment-0001.sig>


More information about the libvir-list mailing list