写 shell 脚本有感

1. grep 时  Binary file (standard input) matches

加上 -a 解决

v_rowline_319=`cat ${v_logfile}_319 | grep -a "totalLine:" | awk -F ':' '{print $8}' | awk 'END {print}'`

2. shell  -eq 和 = 的区别

-eq
用于 INTEGER 类型比较。

INTEGER1 -eq INTEGER2
    INTEGER1 is equal to INTEGER2

=
即适用于 STRING 类型比较,又适用于 INTEGER 类型比较。
STRING1 = STRING2
    the strings are equal
STRING1 != STRING2
    the strings are not equal
INTEGER1 -eq INTEGER2
    INTEGER1 is equal to INTEGER2
 

3. 几天没写HSQL,手生了。写了一个SQL,在hive窗口中得到的结果A是正确的,当hive -e "$sql" 时得到的结果B。且A!=B

hive >

原因:hive -e 外围已经有双引号了,内部子查询应该用单引号。不常见,发生了让人不好定位

发布了131 篇原创文章 · 获赞 79 · 访问量 31万+

猜你喜欢

转载自blog.csdn.net/qq_31780525/article/details/103353966
今日推荐