Skip to content

Commit

Permalink
Fix interface selection on systems where more than one NICs are up
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian-Roth committed Sep 9, 2019
1 parent 54beb9b commit ca3c2fa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/common/input.sh
Expand Up @@ -29,7 +29,7 @@ if [[ $guessdefaults == 1 ]]; then
;;
esac
allinterfaces=$(getAllNetworkInterfaces)

This comment has been minimized.

Copy link
@mastacontrola

mastacontrola Sep 13, 2019

Member

instead of running two seperate internal functions, I think all you need to do to fix this is wrap the allinterfaces=$(getAllNetworkInterfaces) in a pair of () as well, so change line above to:
allinterfaces=($(getAllNetworkInterfaces))

This comment has been minimized.

Copy link
@Sebastian-Roth

Sebastian-Roth Sep 13, 2019

Author Member

@mastacontrola Thanks for the suggestion. I think I have played with that as well but it did cause issues later on in the code. As well it might not work on differnt shells like ZSH, I am not sure. So I just went ahead and used the simple awk foo.

strSuggestedInterface=${allinterfaces[0]}
strSuggestedInterface=$(echo ${allinterfaces} | awk '{print $1}')
if [[ -z $strSuggestedInterface ]]; then
echo "ERROR: Not able to find a network interface that is up on your system."
exit 1
Expand Down

0 comments on commit ca3c2fa

Please sign in to comment.