Skip to content

Commit a4d024f

Browse files
olafheringliuw
authored andcommitted
tools/hv: reduce resouce usage in hv_get_dns_info helper
Remove the usage of cat. Replace the shell process with awk with 'exec'. Also use a generic shell because no bash specific features will be used. Signed-off-by: Olaf Hering <[email protected]> Acked-by: Wei Liu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Wei Liu <[email protected]> Message-ID: <[email protected]>
1 parent 07dfa6e commit a4d024f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/hv/hv_get_dns_info.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/bin/bash
1+
#!/bin/sh
22

33
# This example script parses /etc/resolv.conf to retrive DNS information.
44
# In the interest of keeping the KVP daemon code free of distro specific
@@ -10,4 +10,4 @@
1010
# this script can be based on the Network Manager APIs for retrieving DNS
1111
# entries.
1212

13-
cat /etc/resolv.conf 2>/dev/null | awk '/^nameserver/ { print $2 }'
13+
exec awk '/^nameserver/ { print $2 }' /etc/resolv.conf 2>/dev/null

0 commit comments

Comments
 (0)