
ショコラ
LinuxでIPアドレスを1つ取得するには?
「hostname -I | cut -d ‘ ‘ -f1」でキメマス。

もっさん先輩
①IPアドレスを1つ表示します。
hostname -I | cut -d ' ' -f1
# hostname -I | cut -d ' ' -f1
118.27.68.139
②IPアドレスを1つ取得します。
`hostname -I | cut -d ' ' -f1`
# echo `hostname -I | cut -d ' ' -f1`
118.27.68.139
③IPアドレスを1つ取得します。
$(hostname -I | cut -d ' ' -f1)
# echo $(hostname -I | cut -d ' ' -f1)
118.27.68.139