LinuxSir.cn,穿越时空的Linuxsir!

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

ambiguous redirect

[复制链接]
发表于 2009-3-3 13:00:57 | 显示全部楼层 |阅读模式
#!/bin/bash
# read from /etc/fstab

file=/etc/fstab

read line1 < $File

echo "First line in $File is:"
echo "$line1"
echo
echo "Second line in $File is:"
echo "$line2"

exit 0

[root@oracletest shelltxt]# ./111
./111: line 9: $File: ambiguous redirect
First line in  is:
Second line in  is:
 楼主| 发表于 2009-3-3 13:02:17 | 显示全部楼层
高手帮忙看看
回复 支持 反对

使用道具 举报

发表于 2009-3-3 13:23:53 | 显示全部楼层
#!/bin/bash
File=/etc/fstab

{
read line1
read line2
}< $File

echo "First line in $File is:"
echo "$line1"
echo

echo "Second line in $File is:"
echo "$line2"

exit 0
回复 支持 反对

使用道具 举报

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

本版积分规则

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