首页 > 系统服务 > 详细

ubuntu下仅仅获取网卡一的ip地址 && shell中字符串拼接

时间:2015-04-22 20:15:39      阅读:537      评论:0      收藏:0      [点我收藏+]

问题描述:

  ubuntu下仅仅获取网卡一的ip地址

问题背景:

  eth0,eth1,eth2……代表网卡一,网卡二,网卡三……

  lo代表127.0.0.1,即localhost

 

sudo ifconfig eth0 | grep inet addr | cut -d : -f 2 | cut -d   -f 1

 

问题描述:

  已知字符串str1, str2, 拼接str1和str2,结果为str3

  

str1=hello
str2=world
str3="$str1 $str2"
echo $str3

 

ubuntu下仅仅获取网卡一的ip地址 && shell中字符串拼接

原文:http://www.cnblogs.com/lasclocker/p/4448419.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!