Skip to content

Commit

Permalink
Feat Modify script to extract and use PC Ethernet interface name for …
Browse files Browse the repository at this point in the history
…Livox connection profile (#82)
  • Loading branch information
IkuoShige authored Oct 26, 2023
1 parent e581832 commit cb504d8
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions docs/document/real_machine/set_up/livox.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,17 @@ LIVOXを接続し、以下のスクリプトを実行することで設定でき
# ip linkコマンドの出力を取得
ip_output=$(ip link)

# 正規表現パターンを定義
pattern="(eno|enp|ens|enx|eth0)[[:alnum:]]*"

# ネットワークインターフェース名の抽出
interface_name=$(echo "$ip_output" | grep -oP '(?<=^\d: )[^\:]+')
IFS=" " read -ra interface_array <<< "$(echo "$interface_name" | awk 'NR==2')"
interface_name=$(echo "$ip_output" | grep -oE "$pattern")

echo "ネットワークインターフェース名: ${interface_array[0]}"
echo "ネットワークインターフェース名: $interface_name"

sudo nmcli connection add \
con-name livox-host \
ifname ${interface_array[0]} \
ifname $interface_name \
type ethernet \
ipv4.method manual \
ipv4.address 192.168.1.50/24 \
Expand Down

0 comments on commit cb504d8

Please sign in to comment.