LinuxSir.cn,穿越时空的Linuxsir!

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

双重循环变量

[复制链接]
发表于 2006-1-5 17:09:12 | 显示全部楼层 |阅读模式
我把用户名密码和sid名字分别放到了3个文件里

  1. $cat users
  2. user1
  3. user2
  4. user3
  5. #cat passwd
  6. passwd1
  7. passwd2
  8. passwd3

  9. $cat sids
  10. oradb1
  11. oradb2
  12. oradb3
复制代码


我要把这3个文件读取到循环变量内。我尝试用

  1. for ((A in `cat users`; B in `cat passwd`; C in `cat sids`))
  2. do
  3. echo sqlplus $A/$B@$C
  4. done
复制代码

似乎抓不出来。请问能做到把3个文件的内容读取到3个循环变量去吗?如果不能可能要考虑用其他工具先合并。那么我改从什么地方下手呢?  谢谢了。:thank
发表于 2006-1-6 00:30:30 | 显示全部楼层
try:


  1. while read -u3 u && read -u4 p && read -u5 s;do
  2.         sqlplus $u/$p@$s
  3. done 3<users 4<passwd 5<sids
复制代码
回复 支持 反对

使用道具 举报

发表于 2006-1-6 01:54:50 | 显示全部楼层
Post by 寂寞烈火
try:


  1. while read -u3 u && read -u4 p && read -u5 s;do
  2.         sqlplus $u/$p@$s
  3. done 3<users 4<passwd 5<sids
复制代码

Very cool!
回复 支持 反对

使用道具 举报

发表于 2006-1-6 11:21:12 | 显示全部楼层
什么意思,能解释下么
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

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