[root@localhost mnt]# sh ipshow.sh 直接显示自己的IP
172.25.254.121
脚本2显示自己电脑的IP:
[root@localhost mnt]# vim ipshow.sh 编辑脚本文件
[root@localhost mnt]# sh ipshow.sh 直接显示自己的IP
172.25.254.121
脚本3显示自己电脑的IP:
[root@localhost mnt]# vim ipshow.sh 编辑脚本文件
[root@localhost mnt]# sh ipshow.sh 直接显示自己的IP
172.25.254.121
但是这三个脚本都存在BUG:
脚本4显示自己电脑的IP:(用awk命令呈现)
[root@localhost mnt]# vim ipshow.sh 编辑脚本文件
[root@localhost mnt]# sh ipshow.sh 调用脚本文件
172.25.254.121
脚本出错的检测:
[root@localhost mnt]# vim ipshow.sh
[root@localhost mnt]# sh ipshow.sh 脚本出错的检测
ipshow.sh: line 11: ifconfg: command not found ifconfig命令写错
[root@localhost mnt]# sh -x ipshow.sh -x检测脚本
+ ifconfg eth0
ipshow.sh: line 11: ifconfg: command not found
+ awk -F ' ' '/inet\>/{print $2}'
[root@localhost mnt]# ping -c1 -w1 172.25.254.121 &> /dev/null
[root@localhost mnt]# ping -c1 -w1 172.25.254.121 &> /dev/null && echo 172.25.254.121 is up || echo 172.25.254.121 is down 意思就是满足条件输出172.25.254.121 is up,不满足条件输出172.25.254.121 is down
172.25.254.121 is up
[root@localhost mnt]# ping -c1 -w1 172.25.254.333 &> /dev/null && echo 172.25.254.333 is up || echo 172.25.254.333 is down 意思就是满足条件输出172.25.254.333 is up,不满足条件输出172.25.254.333 is down
172.25.254.333 is down
检测ip是否运行脚本:
[root@localhost mnt]# vim check_ip.sh 编写脚本
[root@localhost mnt]# sh check_ip.sh 172.25.254.111 调用脚本检测
172.25.254.111 is up
[root@localhost mnt]# sh check_ip.sh 172.25.254.232
172.25.254.232 is down
[root@localhost mnt]# chmod +x nm_check.sh 赋予执行权限
[root@localhost mnt]# /mnt/nm_check.sh 调用
please input a number
[root@localhost mnt]# /mnt/nm_check.sh 44
44 is not in range
[root@localhost mnt]# /mnt/nm_check.sh 4
4 is in range
ef,nt,ot命令:
ef表示互为硬连接
nt表示新的时间
ot表示旧的时间
[root@localhost mnt]# ls
[root@localhost mnt]# touch file
[root@localhost mnt]# ln /mnt/file /mnt/file1 ln命令代表建立同样的链接
[root@localhost mnt]# ll
total 0
-rw-r--r-- 2 root root 0 Jun 10 02:59 file
-rw-r--r-- 2 root root 0 Jun 10 02:59 file1
[root@localhost mnt]# ls -li * 两个文件完全相同
11786435 -rw-r--r-- 2 root root 0 Jun 10 02:59 file
11786435 -rw-r--r-- 2 root root 0 Jun 10 02:59 file1
[root@localhost mnt]# [ "/mnt/file" -ef "/mnt/file1" ]&& echo yes || echo no 文件完全相同互为硬链接返回yes
yes
[root@localhost mnt]# [ "/mnt/file" -ef "/etc/passwd" ]&& echo yes || echo no 文件不相同不为硬链接返回no
no
[root@localhost mnt]# ls
file file1
[root@localhost mnt]# rm -fr file1
[root@localhost mnt]# ll
total 0
-rw-r--r-- 1 root root 0 Jun 10 02:59 file
[root@localhost mnt]# touch file1 建立文件
[root@localhost mnt]# ll
total 0
-rw-r--r-- 1 root root 0 Jun 10 02:59 file
-rw-r--r-- 1 root root 0 Jun 10 03:02 file1 建立时间晚于file
[root@localhost mnt]# [ "file" -ot "file1" ]&& echo yes || echo no file1建立时间晚于file,用ot返回yes
yes
[root@localhost mnt]# [ "file" -nt "file1" ]&& echo yes || echo no file1建立时间晚于file,用nt返回no
no
[root@localhost mnt]# vim file_check.sh 编写脚本测试文件类型,就相当于把上面的命令依次测试一遍罢了
[root@localhost mnt]# sh file_check.sh 调用脚本查看类型
please input a file name after script!!
[root@localhost mnt]# sh file_check.sh /var/lib/mysql/mysql.sock
/var/lib/mysql/mysql.sock is a taojiezi
[root@localhost mnt]# sh file_check.sh /dev/vdb
/dev/vdb is a block file
[root@localhost mnt]# sh file_check.sh /dev/pts/1
/dev/pts/1 is a zifushebei
tr命令转换字符大小写:
[root@localhost mnt]# ls
[root@localhost mnt]# vim test.sh 区分大小写脚本
[root@localhost mnt]# sh test.sh
no
[root@localhost mnt]# sh test.sh hello 调用脚本测试
yes
[root@localhost mnt]# sh test.sh HELLO
no
什么是Hessian
The Hessian binary web service protocol makes web services usable without requiring a large framework, and without learning yet another alphabet soup of protocols. Because it is a binary p
在Spark Shell上,通过创建HiveContext可以直接进行Hive操作
1. 操作Hive中已存在的表
[hadoop@hadoop bin]$ ./spark-shell
Spark assembly has been built with Hive, including Datanucleus jars on classpath
Welcom
JMS Message Delivery Reliability and Acknowledgement Patterns
http://wso2.com/library/articles/2013/01/jms-message-delivery-reliability-acknowledgement-patterns/
Transaction and redelivery in
转载请出自出处:http://eksliang.iteye.com/blog/2177567 一、游标
数据库使用游标返回find的执行结果。客户端对游标的实现通常能够对最终结果进行有效控制,从shell中定义一个游标非常简单,就是将查询结果分配给一个变量(用var声明的变量就是局部变量),便创建了一个游标,如下所示:
> var