+ -
当前位置:首页 → 问答吧 → 需要用ctrl+a切换屏幕输出,等待特定信息出现,expect脚本怎么写

需要用ctrl+a切换屏幕输出,等待特定信息出现,expect脚本怎么写

时间:2011-03-01

来源:互联网

#!/bin/bash
cat ./囗囗囗囗囗囗.txt|while read line;do
echo $line
cat >/etc/nginx/alternatives/${line}.conf <<eof
server {
server_name $line;
root /var/www/$line;
include /etc/nginx/fastcgi_php;
location / {
index index.php;
if (!-e \$request_filename) {
rewrite ^(.*)\$ /index.php last;
}
}
}
eof
done

目的:
读取yuming.txt中的文本 一行一个的那种
然后在路径etc/nginx/alternatives/中创建相应的文件
不知道为什么不能执行,提示
/bin/bash^M: bad interpreter: No such file or directory

作者: 火雪心   发布时间: 2011-03-01

文件名怎么是囗囗囗囗囗囗.txt
字符编码没问题吧

作者: gamesun   发布时间: 2011-03-01

发到论坛上就这样
其实是yuming.txt
发到论坛上就变了

作者: 火雪心   发布时间: 2011-03-01

^M
这是常见的格式错误。你是在windows下写的这个脚本吧。
安装tofrodos或dos2unix转一下格式

作者: trigger   发布时间: 2011-03-01

热门下载

更多