LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
查看: 745|回复: 1

我写了个脚本,可是现在自己看不懂了

[复制链接]
发表于 2004-12-4 18:17:29 | 显示全部楼层 |阅读模式
麻烦那位Shell高手帮帮忙解释一下

  1. #!/bin/sh
  2. # echotwolines.sh
  3. tmpfile="/tmp/.echotwolines.tmp-`date  +%H-%M-%S--%y`"
  4. touch $tmpfile
  5. exec 8<&0
  6. exec 8<$tmpfile
  7. read line1
  8. read line2
  9. read line3
  10. exec 0<&8
  11. rm -rf $tmpfile
  12. echo $line1
  13. echo $line2
复制代码
发表于 2004-12-4 18:46:36 | 显示全部楼层
  Moving File Descriptors
       The redirection operator

              [n]<&digit-

       moves the file descriptor digit to file descriptor n, or  the  standard
       input (file descriptor 0) if n is not specified.  digit is closed after
       being duplicated to n.

       Similarly, the redirection operator

              [n]>&digit-

       moves the file descriptor digit to file descriptor n, or  the  standard
       output (file descriptor 1) if n is not specified.
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表