Chinaunix首页 | 论坛 | 博客
  • 博客访问: 84367
  • 博文数量: 18
  • 博客积分: 1521
  • 博客等级: 上尉
  • 技术积分: 150
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-22 18:07
文章分类

全部博文(18)

文章存档

2014年(4)

2011年(1)

2010年(4)

2008年(9)

我的朋友

分类: LINUX

2014-04-09 14:56:00


点击(此处)折叠或打开

  1. #!/bin/bash
  2. ipp (){
  3. exec < $1     #确定全局有效
  4. while read a
  5. do
  6. sring=`curl -s "{a}&action=2" |grep '
    • ' |awk -F'[><]+' '{
    • print $5}'`
    • echo $a $sring
    • done
    • }
    • case $1 in
    • -f)
    •         shift #参数向左移动一位
    •         ipp $1
    • ;;
    • -i)
    •         shift
    •         sring=`curl -s "{1}&action=2" |grep '
      • ' |awk -F'[
      • ><]+' '{print $5}'`
      •         echo $1 $sring
      • ;;
      • *)
      •         echo "[Help]
      •         $0 need -f or -i
      •         -f ------- argument is a file
      •         -i ------- argument is a IP
      • [For example]:
      •         $0 -f filename
      •         $0 -i ipadress
      •         "
      • ;;
      • esac

exec命令

作用

exec ls

shell中执行lsls结束后不返回原来的shell中了

exec 

file中的内容作为exec的标准输入

exec >file

file中的内容作为标准写出

exec 3

file读入到fd3

sort <&3

fd3中读入的内容被分类

exec 4>file

将写入fd4中的内容写入file

ls >&4

Ls将不会有显示,直接写入fd4中了,即上面的file

exec 5<&4

创建fd4的拷贝fd5

exec 3<&-

关闭fd3



阅读(1476) | 评论(0) | 转发(0) |
0

上一篇:xinetd出现 per_source_limit from=的问题

下一篇:没有了

给主人留下些什么吧!~~