1.获得ip#!/bin/bashifconfig $1 |grep "inet addr:" |awk '{print $2}' |cut -c 6-执行脚本[root@xysys192 ~]# ./get_ip.sh eth0192.168.0.100
分类:
其他好文 时间:
2015-07-29 15:34:28
阅读次数:
106
今天在VS2013中调试SOCKET编程时,遇到了点小问题:
问题代码为:
inet_ntoa(addrClient.sin_addr);
生成错误消息为:
error C4996: 'inet_ntoa': Use inet_ntop() or InetNtop() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable...
分类:
Web程序 时间:
2015-07-24 18:31:09
阅读次数:
868
1.使用正则匹配文件名 ## grep -n ‘[^\/][a-zA-Z0-9]*[.a-zA-Z0-9][a-zA-Z0-9]*$‘ regular_express.txt /etc/init.d/hello.h /etc/init.d/hehe 2.使用sed提取出网卡IP ? (1) # ifconfig eth0 |grep ‘inet addr...
分类:
系统相关 时间:
2015-07-01 20:46:45
阅读次数:
172
#!/bin/bashDate=`echo $(date +%Y\-%m\-%d\ %H:%M:%S)`HostName=`hostname`IP=`ifconfig eth0 | grep "inet addr" | cut -f 2 -d ":" | cut -f 1 -d " "`Server...
分类:
系统相关 时间:
2015-06-16 18:42:02
阅读次数:
154
方法二
/sbin/ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v inet6|awk ‘{print $2}’|tr -d “addr:”方法一
获取本机ip地址地址,并保存到变量中
arg=ifconfig eth0 |grep "inet addr"| cut -f 2 -d ":"|cut -f 1 -d " "
ipaddr=arge...
分类:
系统相关 时间:
2015-06-04 17:07:48
阅读次数:
201
在看完Linux程序设计中关于socket套接字这一章套接字的通信流程的介绍后,自己写了客户端和服务器端的程序。发现了一些需要注意的问题。客户端:套接字Internet地址s_addr不能直接用127.0.0.1或者是这个字符串“127.0.0.1”来赋值,而是应该使用inet_addr("127.0.0.1").在con..
分类:
系统相关 时间:
2015-05-15 15:46:34
阅读次数:
151
这几天一直都在和IP地址打交道.GDB出来一个变量,就到计算器里面看看二进制,然后每八位的去计算得出IP地址,着实不胜其烦.搜了一下网上的信息,也没有找到类似的工具.可能大家都觉得写这么一个东西太简单了.但是其实,无论是否简单,真正能够产生便利的命令,就都是不错的命令.既然没有现成的可用,那索性就自己写一个.算来也没有几行代码.
说说这个过程的波折吧.这么简单一个程序,写出来各种问题.
1. ...
分类:
系统相关 时间:
2015-04-27 23:47:23
阅读次数:
181
问题描述: ubuntu下仅仅获取网卡一的ip地址问题背景: eth0,eth1,eth2……代表网卡一,网卡二,网卡三…… lo代表127.0.0.1,即localhostsudo ifconfig eth0 | grep 'inet addr' | cut -d : -f 2 | cut ...
分类:
系统相关 时间:
2015-04-22 20:17:12
阅读次数:
143
定制板卡中bash无法使用,使用标准sh完成对系统及业务监控 #!?/bin/sh
#Process_Name="/guard?/aps?/sa?/zyguard"
Process_Name="/mp?/mcu"
#获取主机IP地址
ip=`ifconfig?eth0?|grep?"inet?addr"|?c...
分类:
系统相关 时间:
2015-04-09 17:57:26
阅读次数:
162
[cpp]view plaincopyCStringipaddress;ipaddress="192.168.39.207";DWORDm_dwPuIp;m_dwPuIp=inet_addr(ipaddress);有一个错误:“inet_addr”: 不能将参数 1 从“CString”转换为“co...
分类:
Web程序 时间:
2015-04-01 15:05:28
阅读次数:
162